mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-12-03 05:10:04 +01:00
Replace webpack with esbuild
This commit is contained in:
1 parent
7e3e2dc5b9
commit
ecb1b76891
13 files changed
+750
-7990
No files matched your search
+6
-25
@@ -52,7 +52,7 @@ function swallowError(e) {
|
||||
const runAsync = (command, args) => new Promise((resolve, reject) => {
|
||||
const proc = spawn(command, args)
|
||||
.on('error', reject)
|
||||
.on('exit', resolve);
|
||||
.on('exit', code => code ? reject(new Error(`${command} ${args.join(' ')} exited with code ${code}`)) : resolve());
|
||||
|
||||
proc.stdout.pipe(process.stdout);
|
||||
proc.stderr.pipe(process.stderr);
|
||||
@@ -354,26 +354,9 @@ const patchWebWorkerTask = cb => {
|
||||
cb();
|
||||
};
|
||||
|
||||
const webpackScript = argv.debug ? 'webpack-debug' : 'webpack-prod';
|
||||
const webpackArgs = ['--'];
|
||||
|
||||
if (argv.beta) {
|
||||
webpackArgs.push('--env', 'beta');
|
||||
}
|
||||
|
||||
if (argv.timing) {
|
||||
webpackArgs.push('--env', 'timing');
|
||||
}
|
||||
|
||||
// each bundle is built in its own webpack process, webpack builds multiple configs
|
||||
// in a single process one after another, so this makes use of multiple cores
|
||||
const webpackBundles = argv.main ? ['bootstrap'] : ['bootstrap', 'bootstrap-admin', 'bootstrap-tools'];
|
||||
const webpackProd = gulp.parallel(...webpackBundles.map(bundle => {
|
||||
const task = npmScript(webpackScript, [...webpackArgs, '--env', `bundle=${bundle}`]);
|
||||
task.displayName = `webpack (${bundle})`;
|
||||
return task;
|
||||
}));
|
||||
const webpackAdmin = npmScript('webpack-admin');
|
||||
const clientArgs = ['--', ...['debug', 'beta', 'timing', 'main'].filter(arg => argv[arg]).map(arg => `--${arg}`)];
|
||||
const clientProd = npmScript('client', clientArgs);
|
||||
const clientAdmin = npmScript('client-admin');
|
||||
const sw = npmScript('sw');
|
||||
|
||||
const assets = gulp.series(assetsCopy, assetsRev);
|
||||
@@ -426,13 +409,11 @@ const empty = cb => cb();
|
||||
const spritesTask = argv.sprites ? sprites : empty;
|
||||
//const buildSprites = gulp.series(tsTools, sprites);
|
||||
|
||||
// tsc and webpack depend on generated files (codegen + rev.ts from assets), sass does not,
|
||||
// so sass runs alongside them. webpack is the long pole. sw + size must wait for all of them.
|
||||
const build = gulp.series(clean, setProd, gulp.parallel(
|
||||
gulp.series(gulp.parallel(codegen, assets), gulp.parallel(ts, webpackProd)),
|
||||
gulp.series(gulp.parallel(codegen, assets), gulp.parallel(ts, clientProd)),
|
||||
sassTasks,
|
||||
), sw, size);
|
||||
const admin = gulp.series(cleanAdmin, setProd, sassAdmin, ts, webpackAdmin);
|
||||
const admin = gulp.series(cleanAdmin, setProd, sassAdmin, ts, clientAdmin);
|
||||
const dev = gulp.series(clean, spritesTask, common, gulp.parallel(serverDev, watch, watchTools));
|
||||
|
||||
export {
|
||||
|
||||
Reference in new issue
Block a user