-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy pathwebpack.config.js
44 lines (37 loc) · 983 Bytes
/
webpack.config.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
const fs = require('fs');
const path = require('path');
const {bannerLoader, terser} = require('../../lib/webpack/webpack.utils.js');
const pkg = require('./package.json');
function getEntry() {
const packageName = 'ui-grid.language';
const localeFolder = './src/js/';
const mainJs = './src/index.js';
const entries = {
[`${packageName}.all`]: mainJs,
[`${packageName}.all.min`]: mainJs
};
fs.readdirSync(path.resolve(__dirname, localeFolder)).forEach(lang => {
const locale = lang.replace('.js', '');
entries[`${packageName}.${locale}`] = `${localeFolder}${lang}`;
entries[`${packageName}.${locale}.min`] = `${localeFolder}${lang}`;
});
return entries;
}
module.exports = {
mode: 'production',
entry: getEntry(),
output: {
pathinfo: false,
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
optimization: {
minimize: true,
minimizer: [
terser
]
},
plugins: [
bannerLoader
]
};