webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, chunks: false, chunkModules: false }) + '\n') })
(function initWebpack() { var webpack = require('webpack'); var webpackConfig = require('./webpack.config'); var compiler = webpack(webpackConfig); app.use(require('webpack-dev-middleware')(compiler, { noInfo: true, publicPath: webpackConfig.output.publicPath })); app.use(require('webpack-hot-middleware')(compiler, { log: console.log, path: '/__webpack_hmr', heartbeat: 10 * 1000 })); })();
console.log('Creating an optimized production build...'); const compiler = webpack(config); return new Promise((resolve, reject) => { compiler.run((err, stats) => {
const compiler = webpack(config); return new Promise((resolve, reject) => { compiler.run((err, stats) => {
const compiler = webpack(config); return new Promise((resolve, reject) => { compiler.run((err, stats) => {
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { if (err) throw err webpack(webpackConfig, (err, stats) => { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. chunks: false, chunkModules: false }) + '\n\n') if (stats.hasErrors()) { console.log(chalk.red(' Build failed with errors.\n')) process.exit(1) } console.log(chalk.cyan(' Build complete.\n')) console.log(chalk.yellow( ' Tip: built files are meant to be served over an HTTP server.\n' + ' Opening index.html over file:// won\'t work.\n' )) }) })
new WebpackDevServer(webpack(webpackConfig), { contentBase: [ config.get('buildDirectory'), '/' ].join(''), headers: { 'Access-Control-Allow-Origin': '*' }, historyApiFallback: true, hot: true, noInfo: false, publicPath: webpackConfig.output.publicPath, proxy: { '*': 'http://' + host + ':' + appPort } }).listen(devServerPort, host, function (err) { if (err) { console.log(err); } console.log('Webpack Dev Server running at ' + host + ':' + devServerPort); });
webpack(config, (err, stats) => { if (err) { console.error(err); return; } console.log(stats.toString({ chunks: false, // Makes the build much quieter colors: true // Shows colors in the console })); });
new WebpackDevServer(webpack(config), { publicPath: config.output.publicPath, hot: true, historyApiFallback: true }).listen(3000, '0.0.0.0', function (err, result) { if (err) { return console.log(err); } console.log('Listening at http://0.0.0.0:3000/'); });
webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, chunks: false, chunkModules: false }) + '\n\n') console.log(chalk.cyan('编译完毕.\n')) })
const compiler = webpack(config); return new Promise((resolve, reject) => { compiler.run((err, stats) => {
const compiler = webpack(config); return new Promise((resolve, reject) => { compiler.run((err, stats) => {
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { if (err) throw err webpack(webpackConfig, (err, stats) => { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. chunks: false, chunkModules: false }) + '\n\n') if (stats.hasErrors()) { console.log(chalk.red(' Build failed with errors.\n')) process.exit(1) } console.log(chalk.cyan(' Build complete.\n')) console.log(chalk.yellow( ' Tip: built files are meant to be served over an HTTP server.\n' + ' Opening index.html over file:// won\'t work.\n' )) }) })
webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, chunks: false, chunkModules: false }) + '\n') })
webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, chunks: false, chunkModules: false }) + '\n') })