-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-config.webpack-concat-plugin.js
53 lines (52 loc) · 1.1 KB
/
get-config.webpack-concat-plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const merge = require('webpack-merge');
const ConcatPlugin = require('webpack-concat-plugin');
module.exports = function (options) {
console.log('=====get-config.webpack-concat-plugin.js=====');
if (!options.isUsed) {
return {}
}
let config = {
plugins: [
new ConcatPlugin({
sourceMap: true,
uglify: false,
name: 'Module1',
fileName: '[name].js',
outputPath: '/bundle/',
filesToConcat: [
'./frontend/Module1/script1.js',
'./frontend/Module1/script2.js',
]
}),
new ConcatPlugin({
sourceMap: true,
uglify: true,
name: 'Module2',
fileName: '[name].js',
outputPath: '/bundle/',
filesToConcat: [
'./frontend/Module2/script1.js',
'./frontend/Module2/script2.js',
]
})
]
};
if (options.isBuildModuleAll) {
config = merge(config, {
plugins: [
new ConcatPlugin({
sourceMap: true,
uglify: true,
name: 'module-all',
fileName: '[name].js',
outputPath: '/bundle/',
filesToConcat: [
'./public/bundle/Module1.js',
'./public/bundle/Module2.js',
]
})
]
});
}
return config;
};