diff options
Diffstat (limited to 'config/webpack.config.js')
-rw-r--r-- | config/webpack.config.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js index 896f832c749..9caec679915 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -105,15 +105,15 @@ if (IS_EE) { }); } -const mainConfig = { - ...baseConfig, +module.exports = { + mode: IS_PRODUCTION ? 'production' : 'development', - name: 'main', + context: path.join(ROOT_PATH, 'app/assets/javascripts'), entry: generateEntries, output: { - ...baseConfig.output, + path: path.join(ROOT_PATH, 'public/assets/webpack'), publicPath: '/assets/webpack/', filename: IS_PRODUCTION ? '[name].[chunkhash:8].bundle.js' : '[name].bundle.js', chunkFilename: IS_PRODUCTION ? '[name].[chunkhash:8].chunk.js' : '[name].chunk.js', @@ -239,7 +239,6 @@ const mainConfig = { }, plugins: [ - ...baseConfig.plugins, // manifest filename must match config.webpack.manifest_filename // webpack-rails only needs assetsByChunkName to function properly new StatsWriterPlugin({ @@ -272,7 +271,7 @@ const mainConfig = { }), new webpack.NormalModuleReplacementPlugin(/^ee_component\/(.*)\.vue/, function(resource) { - if (Object.keys(mainConfig.resolve.alias).indexOf('ee') >= 0) { + if (Object.keys(module.exports.resolve.alias).indexOf('ee') >= 0) { resource.request = resource.request.replace(/^ee_component/, 'ee'); } else { resource.request = path.join( @@ -282,6 +281,9 @@ const mainConfig = { } }), + // compression can require a lot of compute time and is disabled in CI + IS_PRODUCTION && !NO_COMPRESSION && new CompressionPlugin(), + // WatchForChangesPlugin // TODO: publish this as a separate plugin IS_DEV_SERVER && { @@ -340,8 +342,8 @@ const mainConfig = { inline: DEV_SERVER_LIVERELOAD, }, + devtool: NO_SOURCEMAPS ? false : devtool, + // sqljs requires fs node: { fs: 'empty' }, }; - -module.exports = [mainConfig, visualReviewToolbarConfig]; |