Fix dll webpack config

This commit is contained in:
SleepWalker 2019-12-07 22:01:48 +02:00
parent c638c1566e
commit 73e1af6e89

View File

@ -2,8 +2,7 @@
/* eslint-env node */ /* eslint-env node */
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const supportedLocales = require('app/i18n'); const vendor = Object.keys(require('./packages/app/package.json').dependencies);
const vendor = Object.keys(require('./package.json').dependencies);
const isProduction = process.argv.some(arg => arg === '-p'); const isProduction = process.argv.some(arg => arg === '-p');
const isTest = process.argv.some(arg => arg.indexOf('karma') !== -1); const isTest = process.argv.some(arg => arg.indexOf('karma') !== -1);
@ -24,20 +23,7 @@ const webpackConfig = {
mode: 'development', mode: 'development',
entry: { entry: {
vendor: vendor vendor,
.concat([
'core-js/library',
'redux-devtools',
'redux-devtools-dock-monitor',
'redux-devtools-log-monitor',
'react-transform-hmr',
'react-transform-catch-errors',
])
.concat(
Object.keys(supportedLocales).map(
locale => `react-intl/locale-data/${locale}.js`,
),
),
}, },
output: { output: {
@ -47,15 +33,12 @@ const webpackConfig = {
publicPath: '/', publicPath: '/',
}, },
plugins: [ resolve: {
new webpack.DefinePlugin({ extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
'process.env': { modules: ['./packages/app/node_modules', './node_modules'],
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
}, },
__DEV__: true,
__TEST__: isTest, plugins: [
__PROD__: false,
}),
new webpack.DllPlugin({ new webpack.DllPlugin({
name: '[name]', name: '[name]',
path: path.join(outputPath, '[name].json'), path: path.join(outputPath, '[name].json'),