Skip to content

Commit d3fbac6

Browse files
Fixed empty entry and lost plugin
1 parent 3dd4fc4 commit d3fbac6

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

packages/kaizen-tg/_templates/drupal-9-theme/new/webpack.config.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const glob = require('glob');
99
const path = require('path');
1010
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');
1111
const TerserPlugin = require('terser-webpack-plugin');
12-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1312
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
1413
const options = require('./<%= h.changeCase.lower(name) %>-options');
1514

@@ -25,21 +24,28 @@ const mapJSFilenamesToEntries = (pattern, globOptions) =>
2524
};
2625
}, {});
2726

27+
const entries = {
28+
'entries/sprite': glob.sync(path.resolve(__dirname, 'images/svg/**/*.svg')),
29+
'entries/drupalStyles': glob.sync(
30+
options.cssFiles.drupalComponents,
31+
options.cssFiles.drupalIgnore,
32+
),
33+
...mapJSFilenamesToEntries(options.jsFiles.drupalComponents, {}),
34+
...mapJSFilenamesToEntries(options.jsFiles.storybookComponents, {
35+
ignore: options.jsFiles.storybookIgnore,
36+
}),
37+
};
38+
39+
const storybookStyles = glob.sync(options.cssFiles.storybookComponents, {
40+
ignore: options.cssFiles.storybookIgnore,
41+
});
42+
43+
if (storybookStyles.length) {
44+
entries['entries/storybookStyles'] = storybookStyles;
45+
}
46+
2847
module.exports = {
29-
entry: {
30-
'entries/sprite': glob.sync(path.resolve(__dirname, 'images/svg/**/*.svg')),
31-
'entries/drupalStyles': glob.sync(
32-
options.cssFiles.drupalComponents,
33-
options.cssFiles.drupalIgnore,
34-
),
35-
'entries/storybookStyles': glob.sync(options.cssFiles.storybookComponents, {
36-
ignore: options.cssFiles.storybookIgnore,
37-
}),
38-
...mapJSFilenamesToEntries(options.jsFiles.drupalComponents, {}),
39-
...mapJSFilenamesToEntries(options.jsFiles.storybookComponents, {
40-
ignore: options.jsFiles.storybookIgnore,
41-
}),
42-
},
48+
entry: entries,
4349
output: {
4450
path: options.rootPath.dist,
4551
filename: '[name].js',

0 commit comments

Comments
 (0)