Closed sibelius closed 8 months ago
@sibelius
I hope it helps
//plugins.js
new webpack.DllReferencePlugin({
manifest: require(path.join(PATHS.ROOT_DIR, 'build/dll/vendors.json')),
}),
// ###########################################################
// webpack.dll.config.js
const webpack = require('webpack');
const { PATHS, VENDORS_LIST } = require('./shared/constants');
const dllConfig = () => {
const isProduction = process.env.NODE_ENV === 'production';
return {
context: PATHS.ROOT_DIR,
entry: {
vendors: VENDORS_LIST,
},
output: {
library: '[name]',
path: PATHS.STATIC_DLL,
filename: isProduction ? '[name].[contenthash].dll.js' : '[name].dll.js',
},
mode: isProduction ? 'production' : 'development',
plugins: [
new webpack.DllPlugin({
name: '[name]',
path: 'build/dll/[name].json',
}),
],
};
};
module.exports = dllConfig;
// ###########################################################
"scripts": {
"prestart": "rimraf build && NODE_ENV=development webpack --config scripts/webpack/webpack.dll.config.js",
"start": "NODE_ENV=development webpack-dev-server --config scripts/webpack/webpack.config.js --progress",
"predev": "rimraf build && NODE_ENV=development webpack --config scripts/webpack/webpack.dll.config.js",
"dev": "NODE_ENV=development webpack --config scripts/webpack/webpack.config.js --progress",
"prebuild": "rimraf build && NODE_ENV=production webpack --config scripts/webpack/webpack.dll.config.js",
"build": " NODE_ENV=production webpack --config scripts/webpack/webpack.config.js",
for web package https://github.com/entria/entria-fullstack/tree/master/packages/web