accounts-frontend/webpack.dll.config.js

47 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2019-12-07 16:58:52 +05:30
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-env node */
const path = require('path');
const webpack = require('webpack');
2019-12-08 01:31:48 +05:30
const vendor = Object.keys(require('./packages/app/package.json').dependencies);
2019-12-30 13:12:02 +05:30
const baseConfig = require('./babel.config');
2019-12-07 16:58:52 +05:30
2019-12-30 13:12:02 +05:30
if (process.env.NODE_ENV === 'production') {
2020-05-24 04:38:24 +05:30
throw new Error('Dll plugin should be used for dev mode only');
2019-07-01 09:09:59 +05:30
}
const outputPath = path.join(__dirname, 'dll');
const webpackConfig = {
2020-05-24 04:38:24 +05:30
mode: 'development',
entry: {
vendor: vendor.filter(
(item) =>
// if we include rhl in dll. It won't work for some reason
!item.includes('react-hot-loader'),
),
},
output: {
filename: '[name].dll.js?[hash]',
path: outputPath,
library: '[name]',
publicPath: '/',
},
// @ts-ignore
resolve: baseConfig.resolve,
plugins: [
new webpack.DllPlugin({
name: '[name]',
path: path.join(outputPath, '[name].json'),
}),
new webpack.EnvironmentPlugin({
NODE_ENV: process.env.NODE_ENV,
}),
],
};
module.exports = webpackConfig;