Skip to content

Commit 541216b

Browse files
committed
playground: bundle the static export into a handful of chunks
monaco-editor lazily imports a chunk per language; on the sandboxed dot.li host (static export served from a CAR via a service worker) any chunk the CAR doesn't surface throws ChunkLoadError. Collapse the production client build (LimitChunkCountPlugin + no split/runtime chunks) so the whole bundle ships.
1 parent 91c1568 commit 541216b

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

playground/next.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ const nextConfig = {
1818
typescript: {
1919
ignoreBuildErrors: false,
2020
},
21+
// Sandboxed hosts (dot.li) serve this static export from a CAR via a service
22+
// worker, and `monaco-editor` lazily `import()`s a chunk per language —
23+
// hundreds of files, any one of which 404s if the CAR doesn't surface it
24+
// (ChunkLoadError). Collapse the client build into a handful of chunks so the
25+
// whole bundle ships and loads reliably.
26+
webpack: (config, { webpack, isServer, dev }) => {
27+
if (!isServer && !dev) {
28+
config.optimization.runtimeChunk = false;
29+
config.optimization.splitChunks = false;
30+
config.plugins.push(
31+
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
32+
);
33+
}
34+
return config;
35+
},
2136
}
2237

2338
export default nextConfig

0 commit comments

Comments
 (0)