Skip to content

Instantly share code, notes, and snippets.

@lettertwo
Created May 7, 2014 14:02
Show Gist options
  • Save lettertwo/0bc711c39de7cc9ab484 to your computer and use it in GitHub Desktop.
Save lettertwo/0bc711c39de7cc9ab484 to your computer and use it in GitHub Desktop.
An illustration of the Webpack 1.1.8 entry emission issue when in watch mode (https://github.com/webpack/webpack/issues/256)
// This is our entry point.
// We use `require.ensure` to tell webpack to generate a chunk that bundles `B.js`
require.ensure(['./B'], function (require) {
require('./B');
});
// After starting watch.js, make a change to this file to see the issue
console.log('B?');
// Start this file with `node watch.js`
webpack = require('webpack');
path = require('path');
webpack({
entry: {
A: ['./A']
},
output: {
path: path.join(__dirname, 'built'),
filename: '[name]-built.js',
chunkFilename: '[chunkhash].js'
}
}).watch(100, function (err, stats) {
if (err) console.log(err);
console.log(stats.toString({colors: true, chunks: false}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment