-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
50 lines (47 loc) · 1.02 KB
/
webpack.config.ts
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
import * as path from 'path';
import * as TerserPlugin from 'terser-webpack-plugin';
const config = () => {
const isDev = true;
return {
entry: './src/index.ts',
output: {
// 打包成 commonjs 模块,放入 lib 目录下
path: path.resolve(process.cwd(), 'dist'),
filename: 'lint-md-parser.js',
library: {
type: 'commonjs',
},
},
target: 'node',
mode: isDev ? 'development' : 'production',
devtool: isDev ? 'source-map' : false,
optimization: {
minimize: !isDev,
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: false,
},
},
extractComments: false,
}) as any,
],
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
};
};
export default config;