compiler.run((err, stats) => { if (err) throw err; let json = stats.toJson({}, true); printErrors.call(this, json); if (this.emit) this.emit('webpack.stats', stats); this.console.log(''); utils.each(json.assetsByChunkName, (chunkName, assets) => { this.console.info(`Chunk: ${chunkName}`); if (utils.isArray(assets)) { this.console.log( assets.map(name => ` file: ${name}`).join(os.EOL) ); } this.console.log(''); }); printStats.call(this, json); this.console.info('完成'); next(); });
gulp.task('build:app', (callback) => { compiler.run(function(err, stats) { if(err) { gutil.log('error', new gutil.PluginError('[webpack]', err)); } printReport(stats); callback(); }); });
compiler.run(err => { if (err) { throw err; } const fileContent = fs.readFileSync(bundlePath).toString('ascii'); data = requireFromString(fileContent); sync = false; });
function webpackCompiler (webpackConfig) { return new Promise((resolve, reject) => { const compiler = webpack (webpackConfig) compiler.run((err, stats) => { if (err) { console.log('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() console.log(stats.toString(webpackConfig.stats)) resolve(jsonStats) }) }) }
function compile (config, callback) { config.runner = config.runner || 'ruby' config.engine = config.engine || 'erb' var compiler = webpackCompiler(config) compiler.outputFileSystem = fs compiler.run(callback) }
function build() { console.log('Creating server build..'); fs.emptyDirSync(paths.ssrBuild); let compiler = webpack(config); return new Promise((resolve, reject) => { compiler.run((err, stats) => { if (err) { console.log(err); return; } console.log(stats.toString()); }); }); }
compiler.run(function(err, stats) { console.log('Production compiler done...'); });
// bundle minimalist version of javascript gulp.task('bundle-minimalist', ['mkdir'], function (done) { // update the banner contents (has a date in it which should stay up to date) bannerPlugin.banner = createBanner(); compilerMinimalist.run(function (err, stats) { if (err) { gutil.log(err); } gutil.log('bundled ' + NAME_MINIMALIST + '.js'); done(); }); });
gulp.task('build', function(done) { webpack(frontendConfig).run(onBuild(done)); });
gulp.task("webpack:build-dev", function(callback) { // run webpack devCompiler.run(function(err, stats) { if(err) throw new gutil.PluginError("webpack:build-dev", err); gutil.log("[webpack:build-dev]", stats.toString({ colors: true })); callback(); }); });
compiler.run(() => {})
compiler.run((err, stats) => { if (err) throw err; let json = stats.toJson({}, true); printErrors.call(this, json); if (this.emit) this.emit('webpack.stats', stats); this.console.log(''); utils.each(json.assetsByChunkName, (chunkName, assets) => { this.console.info(`Chunk: ${chunkName}`); if (utils.isArray(assets)) { this.console.log( assets.map(name => ` file: ${name}`).join(os.EOL) ); } this.console.log(''); }); printStats.call(this, json); this.console.info('完成'); next(); });
// bundle minimalist version of javascript gulp.task('bundle-minimalist', ['mkdir'], function (done) { // update the banner contents (has a date in it which should stay up to date) bannerPlugin.banner = createBanner(); compilerMinimalist.run(function (err, stats) { if (err) { gutil.log(err); } gutil.log('bundled ' + NAME_MINIMALIST + '.js'); done(); }); });
gulp.task('build-server', function(done) { webpack(serverConfig).run(onBuild(done)) })
gulp.task('build-frontend', function(done) { webpack(frontendConfig).run(onBuild(done)) })