mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui build
This commit is contained in:
1 parent
9c45527522
commit
7dc31d02fa
15 files changed
+10521
-3
No files matched your search
@@ -0,0 +1,32 @@
|
||||
/* eslint-disable */
|
||||
import fs from 'fs';
|
||||
import webpack from 'webpack';
|
||||
import root from './utils/root';
|
||||
import webpackConfig from './config/webpack';
|
||||
|
||||
export default function ({ watch, production }) {
|
||||
const compiler = webpack(webpackConfig({ watch, production }));
|
||||
compiler.apply(new webpack.ProgressPlugin());
|
||||
|
||||
const outputOptions = {
|
||||
colors: true,
|
||||
errorDetails: true,
|
||||
optimizationBailout: production,
|
||||
};
|
||||
|
||||
function compilerCallback(err, stats) {
|
||||
if (err) {
|
||||
// config errors
|
||||
console.error(err.stack || err);
|
||||
if (err.details) console.error(err.details);
|
||||
process.exit(1);
|
||||
return;
|
||||
}
|
||||
console.log(stats.toString(outputOptions));
|
||||
fs.writeFileSync(root('./.webpackStats.json'), JSON.stringify(stats.toJson(), null, 2));
|
||||
if (!watch && stats.hasErrors()) process.exitCode = 1;
|
||||
}
|
||||
|
||||
if (watch) compiler.watch({}, compilerCallback);
|
||||
else compiler.run(compilerCallback);
|
||||
}
|
||||
Reference in new issue
Block a user