forked from nemoisme/el-validate-table
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
71 lines (67 loc) · 1.58 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
const path = require('path')
const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const env = process.env.NODE_ENV
const isPrd = env === 'production'
const devPlugins = [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: './index.html',
inject: 'body',
minify: {
removeComments: true
}
})
]
module.exports = {
//输入
mode: env,
entry: {
path: !isPrd ? path.join(__dirname, './examples/main.js') : path.join(__dirname, './packages/index.js'),
},
//输出
output: {
path: path.resolve(__dirname, isPrd ? './lib' : './dist'),
filename: isPrd ? 'el-validate-table.js' : 'bundle.js',
library: '[name].js',
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
include: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules/element-ui/src')
],
exclude: /node_modules/
},
{
test: /\.vue$/,
use: 'vue-loader',
},
{
test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/,
loader: 'file-loader'
},
{
test: /\.css$/,
use: ['vue-style-loader', 'style-loader', 'css-loader']
}
]
},
// optimization:{
// minimizer:isPrd,
// },
plugins: [new VueLoaderPlugin()].concat(isPrd ? [] : devPlugins),
devServer: {
port: 3000,
host: '127.0.0.1',
open: true,
hot: true,
overlay: { erros: true }
}
}