-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
71 lines (69 loc) · 1.79 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
71
/*
* @Author: zhaohuanlei
* @Date: 2017-05-18 18:11:12
* @Last Modified by: zhaohuanlei
* @Last Modified time: 2017-05-25 20:29:32
*/
"use strict";
const webpack = require("webpack"),
path = require("path"),
ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
context: __dirname + "/src",
entry: {
app: "./app.js"
},
output: {
path: __dirname + "/dist",
filename: "[name].bundle.js",
publicPath: "/dist/"
},
devServer: {
contentBase: __dirname
},
resolve: {
modules: [path.resolve(__dirname, "./src"), "node_modules"],
//extensions:[".js", ".css", ".vue"]
},
module: {
rules: [
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
loader: ["css-loader"]
})
},
{
test: /\.(sass|scss)$/,
use: ExtractTextPlugin.extract({
loader: ["css-loader", "sass-loader"]
})
},
{
test: /\.js$/,
use: [{
loader: "babel-loader",
options: { presets: ["env"] }
}]
},
{
test: /\.(jpg|png)/,
use: "url-loader?limit=8192&name=[name].[ext]&publicPath= &outputPath=../img/"
},
{
test: /\.html$/,
use: "html-withimg-loader"
},
{
test: /\.vue$/,
loader: "vue-loader",
options: {
extractCSS: true
}
}
]
},
plugins: [
new ExtractTextPlugin("[name].bundle.css"),
]
};