-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
107 lines (105 loc) · 2.41 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
const path = require('path');
const root = process.cwd();
const nodeExternals = require('webpack-node-externals');
const TerserPlugin = require('terser-webpack-plugin');
const isDev = false;
module.exports = {
entry: { index: './src/index.ts' },
devtool: 'source-map',
target: 'node',
output: {
path: path.resolve(root, './dist'),
libraryTarget: 'umd',
library: 'anux-common',
clean: true,
},
module: {
// rules: [{
// test: /\.ts$/,
// exclude: /(node_modules|bower_components)/,
// use: {
// loader: 'swc-loader',
// options: {
// // This makes swc-loader invoke swc synchronously.
// sync: true,
// jsc: {
// parser: {
// syntax: 'typescript',
// decorators: true,
// },
// transform: {
// legacyDecorator: true,
// decoratorMetadata: true,
// },
// },
// },
// },
// }]
rules: [{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
onlyCompileBundledFiles: true,
compilerOptions: {
declaration: true,
declarationDir: './dist',
noEmit: false,
},
},
}, {
test: /\.js$/,
use: ['source-map-loader'],
enforce: 'pre'
}],
},
optimization: {
minimizer: [
new TerserPlugin({
parallel: true,
terserOptions: {
compress: !isDev,
keep_classnames: true,
keep_fnames: true,
mangle: !isDev,
sourceMap: true,
},
}),
],
},
externals: [
nodeExternals(),
],
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
stats: {
assets: false,
builtAt: isDev,
cached: false,
cachedAssets: false,
children: false,
chunks: false,
chunkGroups: false,
chunkModules: false,
chunkOrigins: false,
colors: true,
depth: false,
entrypoints: false,
env: false,
errors: true,
errorDetails: true,
hash: false,
logging: 'error',
modules: false,
outputPath: false,
performance: true,
providedExports: false,
publicPath: false,
reasons: false,
source: false,
timings: true,
usedExports: false,
version: true,
warnings: true,
},
};