-
-
Notifications
You must be signed in to change notification settings - Fork 223
/
webpack.prod.config.js
56 lines (53 loc) · 1.72 KB
/
webpack.prod.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
'use strict';
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
mode: 'production',
entry: './src/index.ts',
output: {
environment: {
// The environment supports arrow functions ('() => { ... }').
arrowFunction: false,
// The environment supports BigInt as literal (123n).
bigIntLiteral: false,
// The environment supports const and let for variable declarations.
const: false,
// The environment supports destructuring ('{ a, b } = obj').
destructuring: false,
// The environment supports an async import() function to import EcmaScript modules.
dynamicImport: false,
// The environment supports 'for of' iteration ('for (const x of array) { ... }').
forOf: false,
// The environment supports ECMAScript Module syntax to import ECMAScript modules (import ... from '...').
module: false,
},
filename: 'index.js',
path: path.resolve(__dirname, './lib'),
libraryTarget: 'umd',
library: 'lib',
umdNamedDefine: true,
globalObject: `(typeof self !== 'undefined' ? self : this)`,
},
optimization: {
minimize: true,
},
externals : {
'react': 'react',
'react-dom': 'react-dom',
},
module: {
rules: [
{
test: /\.ts(x?)$/,
include: path.resolve(__dirname, 'src'),
loader: 'ts-loader',
}
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
plugins: [
new CleanWebpackPlugin(),
],
};