Disable dll plugin in storybook

This commit is contained in:
SleepWalker 2020-01-02 16:45:55 +02:00
parent 925a3a868e
commit 3cd2d21fce
2 changed files with 13 additions and 7 deletions

View File

@ -44,7 +44,7 @@
"build:quiet": "yarn run clean && yarn run build:webpack --quiet",
"build:dll": "node ./packages/scripts/build-dll.js",
"build:serve": "http-server --proxy https://dev.account.ely.by ./build",
"sb": "start-storybook -p 9009 --ci",
"sb": "APP_ENV=storybook start-storybook -p 9009 --ci",
"build-storybook": "build-storybook"
},
"husky": {

View File

@ -25,9 +25,11 @@ const isProduction = process.env.NODE_ENV === 'production';
const isAnalyze = process.argv.some(arg => arg === '--analyze');
const isDockerized = !!process.env.DOCKERIZED;
const isStorybook = process.env.APP_ENV === 'storybook';
const isCI = !!process.env.CI;
const isSilent = isCI || process.argv.some(arg => /quiet/.test(arg));
const isCspEnabled = false;
const enableDll = !isProduction && !isStorybook;
process.env.NODE_ENV = isProduction ? 'production' : 'development';
@ -91,7 +93,7 @@ const webpackConfig = {
new HtmlWebpackPlugin({
template: 'packages/app/index.ejs',
favicon: 'packages/app/favicon.ico',
scripts: isProduction ? [] : ['/dll/vendor.dll.js'],
scripts: enableDll ? ['/dll/vendor.dll.js'] : [],
hash: false, // webpack does this for all our assets automagically
filename: 'index.html',
inject: false,
@ -281,13 +283,17 @@ if (isProduction) {
// this will improve build performance
// this mode will be default for dev builds in webpack 5
new EagerImportsPlugin(),
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./dll/vendor.json'),
}),
);
if (enableDll) {
webpackConfig.plugins.push(
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require('./dll/vendor.json'),
}),
);
}
webpackConfig.devServer = {
host: 'localhost',
port: 8080,