Webpack: cache lib.js to disk to prevent occasional OOM

f630c8892a48b3970fd8b38a8edb64333d399d88

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +6 -1Ignore whitespace
src/middleware/webpack-serve.js+5 -1
@@ -1,4 +1,5 @@
11import process from 'node:process';
2+import fs from 'node:fs';
23import webpack from 'webpack';
34import middleware from 'webpack-dev-middleware';
45import { publicLibConfig } from '../../webpack.config.js';
@@ -16,5 +17,8 @@ export default function getWebpackServeMiddleware() {
1617 });
1718 }
1819
1920 return middleware(compiler, {});
21+ // @ts-ignore Use actual file system to ease on heap memory usage
22+ outputFileSystem: fs,
23+ });
2024}
webpack.config.js+1 -0
@@ -24,6 +24,7 @@ export const publicLibConfig = {
2424 hints: false,
2525 },
2626 output: {
27+ path: path.resolve(process.cwd(), 'dist'),
2728 filename: 'lib.js',
2829 libraryTarget: 'module',
2930 },