Changeset View
Changeset View
Standalone View
Standalone View
assets/config/webpack.config.production.js
/** | /** | ||||
* Copyright (C) 2018-2019 The Software Heritage developers | * Copyright (C) 2018-2019 The Software Heritage developers | ||||
* See the AUTHORS file at the top-level directory of this distribution | * See the AUTHORS file at the top-level directory of this distribution | ||||
* License: GNU Affero General Public License version 3, or any later version | * License: GNU Affero General Public License version 3, or any later version | ||||
* See top-level LICENSE file for more information | * See top-level LICENSE file for more information | ||||
*/ | */ | ||||
// webpack configuration for compiling static assets in production mode | // webpack configuration for compiling static assets in production mode | ||||
// import required webpack plugins | // import required webpack plugins | ||||
const TerserPlugin = require('terser-webpack-plugin'); | const TerserPlugin = require('terser-webpack-plugin'); | ||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | ||||
const SentryCliPlugin = require('@sentry/webpack-plugin'); | |||||
const shelljs = require('shelljs'); | |||||
// import webpack development configuration | // import webpack development configuration | ||||
var webpackProdConfig = require('./webpack.config.development'); | var webpackProdConfig = require('./webpack.config.development'); | ||||
// override mode to production | // override mode to production | ||||
webpackProdConfig.mode = 'production'; | webpackProdConfig.mode = 'production'; | ||||
// configure minimizer for js and css assets | // configure minimizer for js and css assets | ||||
Show All 11 Lines | cssProcessorOptions: { | ||||
}, | }, | ||||
minifyFontValues: false, | minifyFontValues: false, | ||||
discardUnused: false, | discardUnused: false, | ||||
zindex: false | zindex: false | ||||
} | } | ||||
}) | }) | ||||
]; | ]; | ||||
// upload js source maps to Sentry for better debugging | |||||
webpackProdConfig.plugins.push(new SentryCliPlugin({ | |||||
include: 'static/js', | |||||
urlPrefix: '~/static/js', | |||||
org: 'swh', | |||||
project: 'swh-webapp', | |||||
url: 'https://sentry.softwareheritage.org/', | |||||
dryRun: process.env.SENTRY_AUTH_TOKEN === undefined, | |||||
release: shelljs.exec('git describe --abbrev=0', {silent: true}).stdout.slice(1, -1), | |||||
sourceMapReference: false | |||||
})); | |||||
// prevent modules concatenation for generating weblabels | // prevent modules concatenation for generating weblabels | ||||
webpackProdConfig.optimization.concatenateModules = false; | webpackProdConfig.optimization.concatenateModules = false; | ||||
// webpack production configuration | // webpack production configuration | ||||
module.exports = webpackProdConfig; | module.exports = webpackProdConfig; |