-
Notifications
You must be signed in to change notification settings - Fork 13
/
webpack.config.js
39 lines (37 loc) · 1.11 KB
/
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
module.exports = env => {
const config = {
mode: 'production',
target: 'node',
entry: {
main: './src/index.ts'
},
output: {
filename: 'evil-eval.min.js',
path: __dirname + '/dist',
libraryTarget: 'commonjs'
},
resolve: {
extensions: ['.ts']
},
module: {
rules: [
{ test: /\.ts$/, loader: 'ts-loader' }
]
}
};
if (env && env.es5) {
config.output.filename = 'evil-eval.es5.min.js';
config.module.rules.unshift({
test: /evaluate\/index\.ts$/,
loader: 'string-replace-loader',
options: {
multiple: [
{ search: '^.*?ES201\\d.*?es201\\d.*$', replace: '', flags: 'gm', strict: true },
{ search: '^.*?es201\\d.*?ES201\\d.*$', replace: '', flags: 'gm', strict: true },
{ search: '^.*?\'\\d\'.*es201\\d.*$', replace: '', flags: 'gm', strict: true }
]
}
});
}
return config;
};