| 142 | } catch (e) { |
| 143 | throw new Error("Failed to generate third-party licenses", { cause: e }); |
| 144 | } |
| 145 | }, |
| 146 | writeBundle(options) { |
| 147 | copyFileSync(path.resolve(projectRootDir, "third-party-licenses.txt"), path.join(options.dir || "dist", "third-party-licenses.txt")); |
| 148 | }, |
| 149 | }; |
| 150 | } |
| 151 | |
| 152 | // Splits the Wasm binary into parts small enough for Cloudflare Pages' 25 MiB single-file limit, rejoined at runtime by `initWasm()` in `src/utility-functions/wasm-loader.ts`. |
| 153 | // Only active when the `SPLIT_WASM` environment variable is set, which CI does for deployments; local builds keep the single file. |
| 154 | function wasmSplitting(): PluginOption { |
| 155 | const PART_SIZE = 24 * 1024 * 1024; |
| 156 | |
| 157 | let partCount = 1; |
| 158 | |
| 159 | return { |
| 160 | name: "wasm-splitting", |