diff --git a/common/static/common/js/karma.common.conf.js b/common/static/common/js/karma.common.conf.js index afbf69cfd965..ea69eaf75433 100644 --- a/common/static/common/js/karma.common.conf.js +++ b/common/static/common/js/karma.common.conf.js @@ -54,7 +54,7 @@ var webpackConfig = require(path.join(appRoot, 'webpack.dev.config.js')); // https://github.com/webpack-contrib/karma-webpack/issues/24#issuecomment-257613167 // // This should be fixed in v3 of karma-webpack -var commonsChunkPluginIndex = webpackConfig[0].plugins.findIndex(function(plugin) { return plugin.chunkNames; }); +// var commonsChunkPluginIndex = webpackConfig[0].plugins.findIndex(function(plugin) { return plugin.chunkNames; }); // Files which are needed by all lms/cms suites. var commonFiles = { @@ -79,7 +79,7 @@ var commonFiles = { ] }; -webpackConfig[0].plugins.splice(commonsChunkPluginIndex, 1); +// webpackConfig[0].plugins.splice(commonsChunkPluginIndex, 1); delete webpackConfig[0].entry; diff --git a/package-lock.json b/package-lock.json index a3c6e426805f..d49fba047c4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -101,7 +101,7 @@ "karma-selenium-webdriver-launcher": "git+https://github.com/PSpSynedra/karma-selenium-webdriver-launcher", "karma-sourcemap-loader": "0.3.7", "karma-spec-reporter": "0.0.20", - "karma-webpack": "4.0.0", + "karma-webpack": "4.0.2", "plato": "1.7.0", "react-test-renderer": "16.4.0", "selenium-webdriver": "3.6.0", @@ -27119,9 +27119,9 @@ } }, "node_modules/karma-webpack": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/karma-webpack/-/karma-webpack-4.0.0.tgz", - "integrity": "sha512-DBgUspDjecuAXL19LeeCDwkgORN1Q+I7wU8f8QljgNkjAWuybllQ75+8JWfHzmJBAulSVub1eIKFfNaZJNo8YQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/karma-webpack/-/karma-webpack-4.0.2.tgz", + "integrity": "sha512-970/okAsdUOmiMOCY8sb17A2I8neS25Ad9uhyK3GHgmRSIFJbDcNEFE8dqqUhNe9OHiCC9k3DMrSmtd/0ymP1A==", "dev": true, "dependencies": { "clone-deep": "^4.0.1", @@ -60041,9 +60041,9 @@ } }, "karma-webpack": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/karma-webpack/-/karma-webpack-4.0.0.tgz", - "integrity": "sha512-DBgUspDjecuAXL19LeeCDwkgORN1Q+I7wU8f8QljgNkjAWuybllQ75+8JWfHzmJBAulSVub1eIKFfNaZJNo8YQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/karma-webpack/-/karma-webpack-4.0.2.tgz", + "integrity": "sha512-970/okAsdUOmiMOCY8sb17A2I8neS25Ad9uhyK3GHgmRSIFJbDcNEFE8dqqUhNe9OHiCC9k3DMrSmtd/0ymP1A==", "dev": true, "requires": { "clone-deep": "^4.0.1", diff --git a/package.json b/package.json index 1d6d383beada..3849471385a8 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "karma-selenium-webdriver-launcher": "git+https://github.com/PSpSynedra/karma-selenium-webdriver-launcher", "karma-sourcemap-loader": "0.3.7", "karma-spec-reporter": "0.0.20", - "karma-webpack": "4.0.0", + "karma-webpack": "4.0.2", "plato": "1.7.0", "react-test-renderer": "16.4.0", "selenium-webdriver": "3.6.0", diff --git a/webpack.common.config.js b/webpack.common.config.js index 042ffa6a8a52..cf9c0aa3f595 100644 --- a/webpack.common.config.js +++ b/webpack.common.config.js @@ -42,9 +42,6 @@ var workerConfig = function() { path: process.env.STATIC_ROOT_LMS, filename: 'webpack-worker-stats.json' }), - new webpack.DefinePlugin({ - 'process.env.JS_ENV_EXTRA_CONFIG': JSON.parse(process.env.JS_ENV_EXTRA_CONFIG), - }) ], module: { rules: [ @@ -131,8 +128,6 @@ module.exports = Merge.smart({ }, plugins: [ - new webpack.NoEmitOnErrorsPlugin(), - new webpack.NamedModulesPlugin(), new BundleTracker({ path: process.env.STATIC_ROOT_CMS, filename: 'webpack-stats.json' @@ -162,6 +157,7 @@ module.exports = Merge.smart({ // recommended workaround, as this plugin is just an optimization. But // because of this, we really don't want to get too fancy with how we // invoke this plugin until we can upgrade karma-webpack. + /* new webpack.optimize.CommonsChunkPlugin({ // If the value below changes, update the render_bundle call in // common/djangoapps/pipeline_mako/templates/static_content.html @@ -169,6 +165,7 @@ module.exports = Merge.smart({ filename: 'commons.js', minChunks: 10 }) + */ ], module: { diff --git a/webpack.dev.config.js b/webpack.dev.config.js index 3987e82fdf7d..13e15bb31754 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -46,10 +46,12 @@ module.exports = _.values(Merge.smart(commonConfig, { loader: 'sass-loader', options: { data: '$base-rem-size: 0.625; @import "paragon-reset";', - includePaths: [ - path.join(__dirname, './node_modules/@edx/paragon/src/utils'), - path.join(__dirname, './node_modules/') - ], + sassOptions: { + includePaths: [ + path.join(__dirname, './node_modules/@edx/paragon/src/utils'), + path.join(__dirname, './node_modules/') + ], + }, sourceMap: true } } diff --git a/webpack.prod.config.js b/webpack.prod.config.js index 9bd6a5493895..5d5cf7615f87 100644 --- a/webpack.prod.config.js +++ b/webpack.prod.config.js @@ -12,27 +12,22 @@ var commonConfig = require('./webpack.common.config.js'); var optimizedConfig = Merge.smart(commonConfig, { web: { output: { - filename: '[name].[chunkhash].js' + filename: '[name].[chunkhash].min.js' }, devtool: false, + optimization: { + runtimeChunk: 'single', + splitChunks: { + chunks: 'all', + }, + }, plugins: [ - new webpack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify('production'), - 'process.env.JS_ENV_EXTRA_CONFIG': process.env.JS_ENV_EXTRA_CONFIG - }), new webpack.LoaderOptionsPlugin({ // This may not be needed; legacy option for loaders written for webpack 1 minimize: true }), - new webpack.optimize.UglifyJsPlugin(), - new webpack.optimize.CommonsChunkPlugin({ - // If the value below changes, update the render_bundle call in - // common/djangoapps/pipeline_mako/templates/static_content.html - name: 'commons', - filename: 'commons.[chunkhash].js', - minChunks: 3 - }) ] - }}); + } +}); // requireCompatConfig only exists so that you can use RequireJS to require a // Webpack bundle (but try not to do that if you can help it). RequireJS knows @@ -51,17 +46,9 @@ var requireCompatConfig = Merge.smart(optimizedConfig, { web: { output: { filename: '[name].js' - }, - plugins: [ - new webpack.optimize.CommonsChunkPlugin({ - // If the value below changes, update the render_bundle call in - // common/djangoapps/pipeline_mako/templates/static_content.html - name: 'commons', - filename: 'commons.js', - minChunks: 3 - }) - ] - }}); + } + } +}); // Step 2: Remove the plugin entries that generate the webpack-stats.json files // that Django needs to look up resources. We never want to accidentally