This commit updates to webpack 5 in order to fix some dependabot errors. Because webpack 5 introduces some breaking changes, this commit also makes some minor changes to the build code.
31 lines
656 B
TypeScript
31 lines
656 B
TypeScript
import * as webpack from 'webpack';
|
|
import { config } from './webpack.config';
|
|
|
|
export function compileView(cb: (err?: Error) => void) {
|
|
webpack(config).run((error, stats) => {
|
|
if (error) {
|
|
cb(error);
|
|
}
|
|
if (stats) {
|
|
console.log(stats.toString({
|
|
errorDetails: true,
|
|
colors: true,
|
|
assets: false,
|
|
builtAt: false,
|
|
version: false,
|
|
hash: false,
|
|
entrypoints: false,
|
|
timings: false,
|
|
modules: false,
|
|
errors: true
|
|
}));
|
|
if (stats.hasErrors()) {
|
|
cb(new Error('Compilation errors detected.'));
|
|
return;
|
|
}
|
|
}
|
|
|
|
cb();
|
|
});
|
|
}
|