-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
76 lines (74 loc) · 1.75 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
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const ESLintWebpackPlugin = require('eslint-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const resolve = filePath => path.join(__dirname, filePath);
const isDev = process.env.NODE_ENV === 'development';
module.exports = {
entry: resolve('../src/lunarDatePicker.tsx'),
devtool: isDev ? 'eval-cheap-source-map' : 'hidden-source-map',
// devtool: 'eval-cheap-source-map',
optimization: {
minimize: !isDev,
minimizer: [
new TerserPlugin({
test: /\.ts[x]?$/,
parallel: 4,
minify: TerserPlugin.swcMinify,
terserOptions: {
compress: {
ecma: 5,
drop_console: !isDev,
},
},
}),
],
},
output: {
path: resolve('../dist/'),
filename: '[name].js',
chunkFilename: '[name].chunk.js',
clean: true,
library: {
name: 'ant-lunar-picker',
type: 'umd',
umdNamedDefine: true,
},
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss', '.css'],
alias: {
'@': resolve('../src'),
},
fallback: {
'stream': require.resolve('stream-browserify'),
'buffer': require.resolve('buffer/')
// 其他需要的 node.js 核心模块
},
},
plugins: [
new CleanWebpackPlugin(),
new ESLintWebpackPlugin({
context: 'src/',
extensions: ['js', 'jsx', 'ts', 'tsx']
}),
],
module: {
rules: [
{
test: /\.ts[x]?$/,
use: [
{
loader:'babel-loader',
},
],
exclude: /node_modules/,
},
]
},
externals: {
'react': 'react',
'react-dom': 'react-dom',
'antd': 'antd'
},
};