I notice that in production the bundle.js file is transferred twice. The second time is requested by the bundle.js file itself.. Is it by default or configuration related?
Also notice that the second time bundle.js is requested takes only 192ms, much less than 634ms on the first time. Maybe because the file is cached.
Note: This is an isomorphic app and restify is there to serve all assets files.
Some of webpack production settings im using:
module.exports = {
devtool: false,
output: {
path: resolve(__dirname, 'dist', 'www'),
publicPath: '/www/',
filename: 'bundle.js',
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
mangle: true,
compress: {
warnings: true,
screw_ie8: true,
conditionals: true,
unused: true,
comparisons: true,
sequences: true,
dead_code: true,
evaluate: true,
if_return: true,
join_vars: true,
},
output: {
comments: false,
},
}),
new ExtractTextPlugin('styles.css'),
],
module: {
loaders: [{
test: /\.js$/,
loader: 'babel-loader',
include: resolve(__dirname, 'src', 'main'),
exclude: /node_modules/,
}, {
test: /\.*css$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader', use: 'css-loader?-autoprefixer!sass-loader',
}),
}],
}
};