-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·68 lines (66 loc) · 1.55 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
var path = require("path");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var VueLoaderPlugin = require("vue-loader/lib/plugin");
const webpack = require("webpack");
var config = {
entry: "./src/main.js",
output: {
path: path.resolve(__dirname + "/dist"), //打包生成文件地址
filename: "[name].build.js", //生成文件ming
publicPath: "/dist/" //文件输出的公共路径
},
module: {
rules: [
{
test: "/.js$/",
use: [
{
loader: "babel-loader",
options: {
presets: ["env"]
}
}
],
include: path.resolve(__dirname + "/src/"),
exclude: /node_modules/
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
include: path.resolve(__dirname + "/src/"),
exclude: /node_modules/
},
{
test: /\.(jpg|png|gif|svg)$/,
use: "url-loader",
include: path.resolve(__dirname + "/src/"),
exclude: /node_modules/
},
{
test: /\.vue$/,
loader: "vue-loader"
}
]
},
resolve: {
extensions: [".js", ".jsx", ".json", ".css"],
alias: {
vue$: "vue/dist/vue.esm.js"
},
modules: ["node_modules"]
},
plugins: [
new HtmlWebpackPlugin({
template: "index.html",
chunks: ["main"]
}),
new VueLoaderPlugin(),
new webpack.HotModuleReplacementPlugin()
],
externals: {
vue: "Vue",
spritejs: "spritejs",
"cat-charts": "CatCharts"
}
};
module.exports = config;