-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.config.lib.babel.js
64 lines (63 loc) · 1.83 KB
/
webpack.config.lib.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
import path from 'path';
import CleanWebpackPlugin from 'clean-webpack-plugin';
export default {
// mode: 'development',
mode: 'production',
entry: './src/chart/index',
output: {
publicPath: '/',
path: path.join(__dirname, 'lib'),
filename: 'RCharts.js',
libraryTarget: 'umd',
umdNamedDefine: true,
},
resolve: {
extensions: ['.js', '.css', '.less']
},
module: {
rules: [{
test: /\.(js)$/,
include: path.join(__dirname, 'src'),
use: ['babel-loader']
}, {
test: /\.(css|less)$/,
include: path.join(__dirname, 'src'),
use: [
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 2,
localIdentName: '[name]_[local]--[hash:base64:5]',
}
},
'postcss-loader',
'less-loader',
]
}, {
test: /\.(png|jpg|jpeg|gif|svg)$/,
include: path.join(__dirname, 'src'),
use: [{
loader: 'url-loader',
options: {
limit: 10000,
name: '/images/[hash].[ext]'
}
}]
}, {
test: /\.ico$/,
include: path.join(__dirname, 'src'),
use: [{
loader: 'url-loader',
options: {
limit: 10000,
name: './images/[name].[ext]'
}
}]
}]
},
devtool: 'none',
plugins: [
new CleanWebpackPlugin(['lib']), // 清除编译目录
],
};