-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathwebpack.build.config.js
62 lines (60 loc) · 1.36 KB
/
webpack.build.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
const webpack = require("webpack");
const version = require("./package.json").version;
const banner = "/**\n" + " * vue-keyboard v" + version + "\n" + " * https://github.com/MartyWallace/vue-keyboard\n" + " * Released under the MIT License.\n" + " */\n";
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
mode: 'production',
entry: './src/index',
output: {
path: __dirname + '/dist',
filename: 'vue-keyboard.js',
library: 'vue-keyboard',
libraryTarget: 'umd',
umdNamedDefine: true,
},
plugins: [
new webpack.DefinePlugin({
"process.env" : {
NODE_ENV : JSON.stringify("production"),
},
}),
new webpack.BannerPlugin({
banner: banner
}),
new VueLoaderPlugin(),
],
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
],
}
],
},
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
uglifyOptions: {
compress: false,
ecma: 6,
mangle: true,
},
}),
],
},
};