- let webpackProductionConfig = Object.create(webpackConfig);
-
- for (let name in webpackProductionConfig.entry) {
- webpackProductionConfig.entry[name] = webpackProductionConfig.entry[name].filter(path => !path.startsWith('webpack'));
- }
-
- webpackProductionConfig.cache = true;
- webpackProductionConfig.output = {
- path: localPath.join(__dirname, 'dist'),
- publicPath: '/services/aai/webapp/',
- filename: '[name].js'
- };
- webpackProductionConfig.resolveLoader = {
- root: [localPath.resolve('.')],
- alias: {
- 'config-json-loader': 'tools/webpack/config-json-loader/index.js'
- }
- };
-
- // remove source maps
- webpackProductionConfig.devtool = undefined;
- webpackProductionConfig.module.preLoaders = webpackProductionConfig.module.preLoaders.filter(preLoader => preLoader.loader != 'source-map-loader');
- webpackProductionConfig.module.loaders.forEach(loader => {
- if (loader.loaders && loader.loaders[0] === 'style') {
- loader.loaders = loader.loaders.map(loaderName => loaderName.replace('?sourceMap', ''));
- }
- });
-
- webpackProductionConfig.module.loaders.push({test: /config.json$/, loaders: ['config-json-loader']});
- webpackProductionConfig.eslint = {
- configFile: './.eslintrc',
- failOnError: true
- };
- webpackProductionConfig.plugins = [
- new webpack.DefinePlugin({
- 'process.env': {
- // This has effect on the react lib size
- 'NODE_ENV': JSON.stringify('production')
- },
- DEBUG: false,
- DEV: false
- }),
- new webpack.optimize.DedupePlugin(),
- new webpack.optimize.UglifyJsPlugin()
- ];
-
- // run production build