-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
39 lines (37 loc) · 1014 Bytes
/
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
var path = require('path'),
webpack = require('webpack'),
uglify = require('uglifyjs-webpack-plugin');
/**
* 常用变量
*/
const projectPath = __dirname;
const appPath = path.join(projectPath, "app");
const assetsPath = path.join(appPath, "assets");
module.exports = {
entry: path.join(projectPath, "js", "index.js"),
output: {
path: assetsPath,
filename: "js/tools.js"
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}, {
test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
use: 'url-loader?limit=8000&name=[name]-[hash].[ext]&outputPath=img/&publicPath=assets/'
},
]
},
plugins: [
// 打包内容里面全局jquery
new webpack.ProvidePlugin({
"$": "jquery",
"jQuery": "jquery",
"window.jQuery": 'jquery'
}),
// 压缩
new uglify()
]
};