-
Notifications
You must be signed in to change notification settings - Fork 207
/
webpack.config.js
64 lines (62 loc) · 1.27 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//@ts-check
const path = require('path');
const webpack = require('webpack');
const tslib = require('tslib');
const baseDir = path.resolve(__dirname)
const TerserPlugin = require("terser-webpack-plugin");
/** @type { import('webpack').Configuration } */
module.exports = {
resolve: {
extensions: ['.ts', '.js', '.json'],
modules: [path.join(baseDir, 'node_modules') /* zk node_modules for zkcml*/, 'node_modules'],
alias: {
'tslib$': 'tslib/tslib.es6.js',
},
},
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader'
},
{
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
],
},
],
},
externals: {
'jquery': 'jq', // for jquery.transit.js
'moment': 'zk.mm', // for moment.js
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
keep_fnames: true,
},
}),
],
},
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/
}),
new webpack.ProvidePlugin((function () {
let options = {};
for (let key in tslib) {
options[key] = ['tslib', key];
}
return Object.assign(options, {
'__extends': [path.join(__dirname, 'extends.js'), 'default'] // fix ZK-5441
});
})())
],
};