forked from tronprotocol/tronweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.base.config.js
41 lines (35 loc) · 1.09 KB
/
webpack.base.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
const path = require('path');
const basePlugins = [
['@babel/plugin-transform-private-methods', { loose: true }],
['@babel/plugin-transform-private-property-in-object', { loose: true }],
['@babel/plugin-transform-class-properties', { loose: true }],
'@babel/plugin-transform-numeric-separator',
'@babel/plugin-transform-runtime',
'@babel/plugin-transform-object-rest-spread',
];
const mode = process.env.NODE_ENV || 'production';
const baseConfig = {
entry: path.resolve(__dirname, 'src', 'index.ts'),
resolve: {
extensions: ['.ts', '.js', '.cjs'],
extensionAlias: {
'.js': ['.ts', '.js', 'cjs'],
},
modules: ['node_modules', path.resolve(__dirname, 'src')],
fallback: {
'querystring-es3': require.resolve('querystring-es3'),
events: require.resolve('events/'),
},
},
devtool: 'source-map',
mode,
};
nodePlugins = [...basePlugins];
if (mode === 'development') {
nodePlugins.push('source-map-support');
}
module.exports = {
basePlugins,
baseConfig,
nodePlugins,
};