-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
65 lines (63 loc) · 1.87 KB
/
vue.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
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { SkeletonPlugin } = require("page-skeleton-webpack-plugin");
const webpack = require("webpack");
const path = require("path");
const merge = require("eslint");
function resolve(dir) {
return path.join(__dirname, dir);
}
module.exports = {
publicPath: "/copy_elm/",
// webpack-dev-server 相关配置
devServer: {
// 设置代理
hot: true, //热加载
host: "0.0.0.0", //ip地址
port: 8080, //端口
https: false, //false关闭https,true为开启
open: true, //自动打开浏览器
proxy: {
"/api": {
//本地
target: "http://localhost:3000",
// 如果要代理 websockets
ws: false,
changeOrigin: true
}
}
},
// css相关配置
css: {
// 是否使用css分离插件 ExtractTextPlugin 生产环境下是true,开发环境下是false
extract: true,
// 开启 CSS source maps?
sourceMap: false,
// css预设器配置项
loaderOptions: {},
// 启用 CSS modules for all css / pre-processor files.
modules: false
},
configureWebpack: {
plugins: [
new SkeletonPlugin({
pathname: path.resolve(__dirname, `./shell`), // 用来存储 shell 文件的地址
staticDir: path.resolve(__dirname, "./dist"), // 最好和 `output.path` 相同
routes: ["/", "/search"] // 将需要生成骨架屏的路由添加到数组中
})
]
},
chainWebpack: config => {
if (process.env.NODE_ENV !== "development") {
// 不等于开发环境
config.plugin("html").tap(opts => {
// 代表 html-webpack-plugin 修改cli3打包压缩的时候会去除注释
opts[0].minify.removeComments = false;
return opts;
});
// config.resolve.alias.set("img", resolve("http://baidu.com"));
}
},
pluginOptions: {
// 第三方插件配置
}
};