Skip to content

Commit cd53e26

Browse files
fix vue build issue on release
1 parent 4a900ad commit cd53e26

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

pkg/sbomscanner/vue.config.js

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
1+
const path = require('path');
12
const webpack = require('webpack');
2-
const baseConfig = require('./.shell/pkg/vue.config')(__dirname);
3+
const vendorConfigFactory = require('./.shell/pkg/vue.config');
34

4-
module.exports = {
5-
...baseConfig,
6-
chainWebpack: (config) => {
7-
if (typeof baseConfig.chainWebpack === 'function') {
8-
baseConfig.chainWebpack(config);
5+
module.exports = () => {
6+
const vendorConfig =
7+
typeof vendorConfigFactory === 'function' ? vendorConfigFactory(__dirname) : vendorConfigFactory;
8+
9+
// Wrap the vendor configureWebpack if it exists.
10+
const vendorConfigureWebpack = vendorConfig.configureWebpack;
11+
const customConfigureWebpack = (config) => {
12+
if (typeof vendorConfigureWebpack === 'function') {
13+
vendorConfigureWebpack(config);
914
}
15+
// Add the @sbomscanner alias to point to the pkg/sbomscanner directory.
16+
config.resolve.alias['@sbomscanner'] = path.resolve(__dirname);
17+
};
1018

19+
// Create an override for __tests__ directories.
20+
const kwChainWebpack = (config) => {
1121
config.plugin('ignore-tests')
1222
.use(webpack.IgnorePlugin, [{ resourceRegExp: /[\\/]__tests__[\\/]/ }]);
13-
},
14-
configureWebpack: baseConfig.configureWebpack,
23+
};
24+
25+
const mergedChainWebpack = (config) => {
26+
if (typeof vendorConfig.chainWebpack === 'function') {
27+
vendorConfig.chainWebpack(config);
28+
}
29+
kwChainWebpack(config);
30+
};
31+
32+
// Merge our custom chainWebpack and configureWebpack with the vendor config.
33+
return Object.assign({}, vendorConfig, {
34+
chainWebpack: mergedChainWebpack,
35+
configureWebpack: customConfigureWebpack,
36+
});
1537
};

0 commit comments

Comments
 (0)