Skip to content

Commit 2cf39da

Browse files
committed
Override library only for klaro-no-translations - so we need to split the config.
1 parent fe5eccc commit 2cf39da

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

webpack.base.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,14 @@ let config = {
4343
},
4444
entry: {
4545
'klaro': path.join(SRC_DIR, 'klaro.js'),
46-
'klaro-no-translations': path.join(SRC_DIR, 'klaro-no-translations.js'),
4746
cm: path.join(SRC_DIR, 'consent-manager.js'),
4847
translations: path.join(SRC_DIR, 'translations.js'),
4948
ide: path.join(SRC_DIR, 'ide.js')
5049
},
5150
output: {
5251
path: BUILD_DIR,
5352
filename: SEPARATE_CSS ? '[name]-no-css.js' : '[name].js',
54-
library: 'klaro',
53+
library: '[name]',
5554
libraryTarget: 'umd',
5655
publicPath: '',
5756
},

webpack.config.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
const { merge } = require('webpack-merge');
2+
const path = require('path');
3+
const SRC_DIR = path.resolve(__dirname, 'src');
24
const baseConfig = require('./webpack.base.js');
35
const prodConfig = require('./webpack.prod.js');
46
const devConfig = require('./webpack.dev.js');
57

68
module.exports = (env, argv) => {
79
switch (argv.mode) {
810
case 'development':
9-
return merge(baseConfig, devConfig);
11+
var config = merge(baseConfig, devConfig);
12+
break;
1013
case 'production':
11-
return merge(baseConfig, prodConfig);
14+
var config = merge(baseConfig, prodConfig);
15+
break;
1216
default:
1317
throw new Error('No matching configuration was found!');
1418
}
19+
// Create config2 for klaro-no-translations.
20+
let config2 = {
21+
...config,
22+
entry: {
23+
'klaro-no-translations': path.join(SRC_DIR, 'klaro-no-translations.js'),
24+
},
25+
output: {
26+
...config.output,
27+
library: 'klaro',
28+
}
29+
};
30+
return [config, config2];
1531
};

0 commit comments

Comments
 (0)