-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.prod.babel.js
66 lines (57 loc) · 1.3 KB
/
webpack.prod.babel.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
65
66
import { DefinePlugin, LoaderOptionsPlugin } from 'webpack';
import UglifyJsPlugin from 'uglifyjs-webpack-plugin';
import path from 'path';
const deployPath = path.resolve(__dirname, 'bin');
const entryPath = path.resolve(__dirname, 'src');
export default {
entry: path.resolve(entryPath, 'index.ts'),
mode: 'production',
output: {
path: deployPath,
filename: 'joymap.min.js',
library: 'joymap',
libraryTarget: 'umd',
umdNamedDefine: true,
},
resolve: {
extensions: ['.wasm', '.ts', '.tsx', '.mjs', '.cjs', '.js', '.json'],
modules: ['node_modules'],
},
module: {
rules: [
{
test: /\.ts$/,
rules: [
{ loader: 'babel-loader' },
{ loader: 'ts-loader', options: { configFile: 'tsconfig.prod.json' } },
],
include: entryPath,
},
],
},
optimization: {
minimizer: [
new UglifyJsPlugin({
parallel: true,
sourceMap: true,
uglifyOptions: {
mangle: {
keep_fnames: true,
},
compress: true,
},
}),
],
},
plugins: [
new DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new LoaderOptionsPlugin({
minimize: true,
debug: false,
}),
],
};