-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.config.js
45 lines (38 loc) · 1.04 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
const webpack = require('webpack');
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
// 監聽
watch: true,
// development (開發模式未壓縮) | production (產品模式可壓縮)
mode: 'production',
// 進入點,每個頁面使用一個 JS 檔
entry: {
'jquery.file-preview': './src/jquery.file-preview.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].min.js'
},
// 需要時再啟動,並搭配 UglifyJSPlugin sourceMap
devtool: 'source-map',
plugins: [
new UglifyJSPlugin({
sourceMap: true
})
],
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}
]
}
};