compiler.watch(opts.watchOpts, (err, stats) => { if (err) return this.console.error(err); let json = stats.toJson({}, true); printErrors.call(this, json); if (this.emit) this.emit('webpack.stats', stats); printStats.call(this, json); this.console.log('实时编译:', Date.now()); next(); });
//dev watch gulp.task('webpack-client-watch', function() { webpack(devConfig[0]).watch(100, function(err, stats) { onBuild()(err, stats); }); });
serverCompiler.watch({}, (err, stats) => { if (err) throw err stats = stats.toJson() stats.errors.forEach(err => console.error(err)) stats.warnings.forEach(err => console.warn(err)) // read bundle generated by vue-ssr-webpack-plugin const bundlePath = path.join(serverConfig.output.path, 'vue-ssr-bundle.json') bundle = JSON.parse(mfs.readFileSync(bundlePath, 'utf-8')) if (template) { cb(bundle, template) } })
api.hook('watch') .add('webpack', api => new Promise((resolve, reject) => { const webpackInstance = webpack(api.config.webpack.toJSON()) webpackInstance.watch({}, (err, stats) => { if (err || stats.hasErrors()) { console.error(err) } api.print(stats.toString({ chunks: false, // Makes the build much quieter colors: true // Shows colors in the console })) }) }) )
gulp.task('build:watch:app', (callback) => { compiler.watch({ aggregateTimeout: 300 }, function(err, stats) { if(err) { gutil.log('error', new gutil.PluginError('[webpack]', err)); } printReport(stats); }); callback(); });
clipped.hook('watch') .add('default', clipped => new Promise((resolve, reject) => { const webpackInstance = getWebpackInstance() webpackInstance.watch({}, (err, stats) => { if (err || stats.hasErrors()) { console.error(err) } console.log(stats.toString({ chunks: false, // Makes the build much quieter colors: true // Shows colors in the console })) }) }) )
serverCompiler.watch({}, (err, stats) => { if (err) throw err; stats = stats.toJson(); if (stats.errors.length) return; // read bundle generated by vue-ssr-webpack-plugin bundle = JSON.parse(readFile(mfs, 'vue-ssr-server-bundle.json')); update(); });
serverCompiler.watch({}, (error, stats) => { if (error) throw error;
webpack(config) .watch({ ignored: /node_modules/ }, (err, stats) => { if (err) { console.error(err); process.exit(1); } if (stats.hash == lastHash) { return; } lastHash = stats.hash; process.stdout.write(stats.toString({ colors: true, hash: true, timings: true, chunks: false, modules: false, children: false }) + '\n\n'); });
Gulp.task('webpack:dev-build', function() { devCompiler.watch({}, function(err, stats) { if (err) { throw new Gutil.PluginError('webpack', err); } Gutil.log('[webpack:build-dev]', stats.toString({ colors: true, chunks: false })); }); });
serverCompiler.watch({},(err,status)=>{ if(err) throw err; status = status.toJson(); status.errors.forEach( err=>console.error(err) ); status.warnings.forEach( warn=>console.warn(warn)); const bundlePath = path.join( serverConfig.output.path, serverConfig.output.filename ) const bundle = mfs.readFileSync(bundlePath,"utf-8"); const m = new Module(); m._compile(bundle,"server-entry.js"); serverBundle = m.exports.default })
gulp.task('watch-server', function() { webpack(serverConfig).watch(100, function(err, stats) { onBuild()(err, stats) nodemon.restart() }) })
compiler.watch(opts.watchOpts, (err, stats) => { if (err) return this.console.error(err); let json = stats.toJson({}, true); printErrors.call(this, json); if (this.emit) this.emit('webpack.stats', stats); printStats.call(this, json); this.console.log('实时编译:', Date.now()); next(); });
gulp.task('webpack-server-watch', function() { webpack(devConfig[1]).watch(100, function(err, stats) { onBuild()(err, stats); }); });
gulp.task('watch-frontend', function() { webpack(frontendConfig).watch(100, onBuild()) })