diff --git a/config/webpack.config.js b/config/webpack.config.js index 03b7b2308ba4..ceb28672bcf3 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -3,19 +3,21 @@ var path = require('path'); var webpack = require('webpack'); var StatsPlugin = require('stats-webpack-plugin'); -var ExtractTextPlugin = require("extract-text-webpack-plugin"); +var ExtractTextPlugin = require('extract-text-webpack-plugin'); var CompressionPlugin = require('compression-webpack-plugin'); // must match config.webpack.dev_server.port var devServerPort = 3808; // set TARGETNODE_ENV=production on the environment to add asset fingerprints -var production = process.env.RAILS_ENV === 'production' || process.env.NODE_ENV === 'production'; +var production = + process.env.RAILS_ENV === 'production' || + process.env.NODE_ENV === 'production'; var config = { entry: { // Sources are expected to live in $app_root/webpack - 'bundle': './webpack/assets/javascripts/bundle.js' + bundle: './webpack/assets/javascripts/bundle.js' }, output: { @@ -30,8 +32,10 @@ var config = { }, resolve: { - extensions: ['', '.js'], - root: path.join(__dirname, '..', 'webpack') + modules: [ + path.join(__dirname, '..', 'webpack'), + path.join(__dirname, '..', 'node_modules') + ] }, module: { @@ -43,18 +47,21 @@ var config = { }, { test: /\.css$/, - loader: ExtractTextPlugin.extract("style-loader", "css-loader") + loader: ExtractTextPlugin.extract({ + fallback: 'style-loader', + use: 'css-loader' + }) }, { test: /(\.png|\.gif)$/, - loader: "url-loader?limit=32767" + loader: 'url-loader?limit=32767' }, { test: /\.scss$/, - loader: ExtractTextPlugin.extract( - 'style-loader', // The backup style loader - 'css-loader?sourceMap!sass-loader?sourceMap' - ) + loader: ExtractTextPlugin.extract({ + fallback: 'style-loader', // The backup style loader + use: 'css-loader?sourceMap!sass-loader?sourceMap' + }) } ] }, @@ -69,11 +76,14 @@ var config = { modules: false, assets: true }), - new ExtractTextPlugin(production ? '[name]-[chunkhash].css' : '[name].css', { - allChunks: true + new ExtractTextPlugin({ + filename: production ? '[name]-[chunkhash].css' : '[name].css', + allChunks: true }), new webpack.DefinePlugin({ - 'process.env': { NODE_ENV: JSON.stringify(production ? 'production' : 'development') } + 'process.env': { + NODE_ENV: JSON.stringify(production ? 'production' : 'development') + } }) ] }; @@ -85,7 +95,6 @@ if (production) { compressor: { warnings: false }, sourceMap: false }), - new webpack.optimize.DedupePlugin(), new webpack.optimize.OccurenceOrderPlugin(), new CompressionPlugin() diff --git a/package.json b/package.json index 97b54388e3b8..625eb218b398 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "eslint": "^3.3.1", "eslint-plugin-react": "^6.1.2", "expose-loader": "~0.6.0", - "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.9.0", "identity-obj-proxy": "^3.0.0", "jest-cli": "^16.0.1", @@ -36,7 +35,7 @@ "stats-webpack-plugin": "^0.2.1", "style-loader": "^0.13.1", "url-loader": "^0.5.7", - "webpack": "^1.9.11", + "webpack": "^2.5.1", "webpack-dev-server": "^1.9.0" }, "optionalDependencies": { @@ -48,6 +47,7 @@ "datatables.net": "~1.10.12", "datatables.net-bs": "~1.10.12", "diff": "~3.0.0", + "extract-text-webpack-plugin": "^2.1.0", "ipaddr.js": "~1.2.0", "jquery": "~2.2.4", "jquery-flot": "~0.8.3", @@ -56,6 +56,7 @@ "jstz": "~1.0.7", "lodash": "~4.15.0", "multiselect": "~0.9.12", + "fbjs": "0.8.12", "react": "^15.1.0", "react-bootstrap": "^0.30.0", "react-dom": "^15.1.0", diff --git a/webpack/assets/javascripts/bundle.js b/webpack/assets/javascripts/bundle.js index 21a0570094c7..6c17ccd5c9de 100644 --- a/webpack/assets/javascripts/bundle.js +++ b/webpack/assets/javascripts/bundle.js @@ -1,10 +1,10 @@ -require('expose?$!expose?jQuery!jquery'); +require('expose-loader?$!expose-loader?jQuery!jquery'); require('jquery-ujs'); -require('expose?_!lodash'); -require('expose?jstz!jstz'); -require('expose?ipaddr!ipaddr.js'); +require('expose-loader?_!lodash'); +require('expose-loader?jstz!jstz'); +require('expose-loader?ipaddr!ipaddr.js'); require('jquery.cookie'); -require('expose?JsDiff!diff'); +require('expose-loader?JsDiff!diff'); require('./bundle_flot'); require('./bundle_multiselect'); require('./bundle_select2');