summaryrefslogtreecommitdiffstats
path: root/webapp/webpack.config.js
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-07-15 08:57:52 -0400
committerJoram Wilander <jwawilander@gmail.com>2016-07-15 08:57:52 -0400
commit8936f65c9032eb363ff936c6bbac5a94a348585d (patch)
tree576e14852031303d1d6715fbd64a3c2b9bca895e /webapp/webpack.config.js
parentb5c5744bc79d99e75629085ccafedd8f50c41916 (diff)
downloadchat-8936f65c9032eb363ff936c6bbac5a94a348585d.tar.gz
chat-8936f65c9032eb363ff936c6bbac5a94a348585d.tar.bz2
chat-8936f65c9032eb363ff936c6bbac5a94a348585d.zip
Improving caching of static assets (#3591)
Diffstat (limited to 'webapp/webpack.config.js')
-rw-r--r--webapp/webpack.config.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/webapp/webpack.config.js b/webapp/webpack.config.js
index 88635ef03..da9ed9600 100644
--- a/webapp/webpack.config.js
+++ b/webapp/webpack.config.js
@@ -4,7 +4,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
-const htmlExtract = new ExtractTextPlugin('html', 'root.html');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
const NPM_TARGET = process.env.npm_lifecycle_event; //eslint-disable-line no-process-env
@@ -28,8 +28,8 @@ var config = {
output: {
path: 'dist',
publicPath: '/static/',
- filename: 'bundle.js',
- chunkFilename: '[name].[hash].[chunkhash].js'
+ filename: '[name].[hash].js',
+ chunkFilename: '[name].[chunkhash].js'
},
module: {
loaders: [
@@ -90,7 +90,7 @@ var config = {
},
{
test: /\.html$/,
- loader: htmlExtract.extract('html?attrs=link:href')
+ loader: 'html?attrs=link:href'
}
]
},
@@ -101,7 +101,6 @@ var config = {
new webpack.ProvidePlugin({
'window.jQuery': 'jquery'
}),
- htmlExtract,
new CopyWebpackPlugin([
{from: 'images/emoji', to: 'emoji'},
{from: 'images/logo-email.png', to: 'images'},
@@ -168,7 +167,18 @@ if (!DEV) {
// Test mode configuration
if (TEST) {
+ config.entry = ['babel-polyfill', './root.jsx'];
+ config.target = 'node';
config.externals = [nodeExternals()];
+} else {
+ // For some reason this breaks mocha. So it goes here.
+ config.plugins.push(
+ new HtmlWebpackPlugin({
+ filename: 'root.html',
+ inject: 'head',
+ template: 'root.html'
+ })
+ );
}
module.exports = config;