Skip to content

Commit 9e6e9d6

Browse files
author
Damien LACHAUME / PALO-IT
committed
Fix build errors
error: `experiments.layers` must be enabled error: webpack import WASM file fail This seems to be a known behaviour.
1 parent 9175db2 commit 9e6e9d6

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

mithril-explorer/next.config.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,41 @@ const nextConfig = {
88
unoptimized: true,
99
},
1010
webpack: function (config, { isServer }) {
11-
config.experiments = { asyncWebAssembly: true };
11+
config.experiments = { layers: true, asyncWebAssembly: true };
12+
13+
const { join } = require('path');
14+
const { access, symlink } = require('fs/promises');
15+
config.plugins.push(
16+
new (class {
17+
apply(compiler) {
18+
compiler.hooks.afterEmit.tapPromise(
19+
'SymlinkWebpackPlugin',
20+
async (compiler) => {
21+
if (isServer) {
22+
const from = join(compiler.options.output.path, '../static');
23+
const to = join(compiler.options.output.path, 'static');
24+
25+
try {
26+
await access(from);
27+
// console.log(`${from} already exists`);
28+
return;
29+
} catch (error) {
30+
if (error.code === 'ENOENT') {
31+
// No link exists
32+
} else {
33+
throw error;
34+
}
35+
}
36+
37+
await symlink(to, from, 'junction');
38+
console.log(`created symlink ${from} -> ${to}`);
39+
}
40+
},
41+
);
42+
}
43+
})(),
44+
);
45+
1246
return config;
1347
}
1448
};

0 commit comments

Comments
 (0)