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
72
73
74
75
76
77
78
const path = require("path")
module.exports = {
publicPath: "",
outputDir: "dist",
assetsDir: "static",
configureWebpack: (config) => {
require("@vux/loader").merge(config, {
plugins: ["vux-ui"]
})
},
chainWebpack: (config) => {
config.resolve.alias.set("@", path.join(__dirname, "src"))
// config.resolve.alias.set(
// "vue$",
// path.join(__dirname, "vue/dist/vue.esm.js")
// );
},
css: {
// 是否开启支持 foo.module.css 样式
requireModuleExtension: true, // 要设置为true,不然element-ui样式不起作用,vue cli4.0.5
// 是否使用 css 分离插件 ExtractTextPlugin,采用独立样式文件载入,不采用 <style> 方式内联至 html 文件中
// extract: true,
// 是否构建样式地图,false 将提高构建速度
sourceMap: false,
// css预设器配置项
loaderOptions: {
sass: {
// prependData: `@import "~@/assets/style/_mixins.scss"`
// prependData: `@import "~@/assets/style/common.scss"` 配置common.scss,配置后导致vant样式不起作用
},
// 默认情况下 `sass` 选项会同时对 `sass` 和 `scss` 语法同时生效
// 因为 `scss` 语法在内部也是由 sass-loader 处理的
// 但是在配置 `data` 选项的时候
// `scss` 语法会要求语句结尾必须有分号,`sass` 则要求必须没有分号
// 在这种情况下,我们可以使用 `scss` 选项,对 `scss` 语法进行单独配置
// 配置后上面的sass,可注释
scss: {},
css: {},
postcss: {
// options here will be passed to postcss-loader
plugins: [
require("postcss-plugin-px2rem")({
rootValue: 56, //换算基数,1rem相当于10px,值为37.5时,1rem为20px,淘宝的flex默认为1rem为10px
// unitPrecision: 5, //允许REM单位增长到的十进制数字。
//propWhiteList: [], //默认值是一个空数组,这意味着禁用白名单并启用所有属性。
// propBlackList: ['border'], //黑名单
exclude: /(node_module)/, //默认false,可以(reg)利用正则表达式排除某些文件夹的方法,例如/(node_module)\/如果想把前端UI框架内的px也转换成rem,请把此属性设为默认值
// selectorBlackList: [], //要忽略并保留为px的选择器
// ignoreIdentifier: false, //(boolean/string)忽略单个属性的方法,启用ignoreidentifier后,replace将自动设置为true。
// replace: true, // (布尔值)替换包含REM的规则,而不是添加回退。
mediaQuery: false, //(布尔值)允许在媒体查询中转换px
minPixelValue: 6
})
]
}
}
},
devServer: {
disableHostCheck: true, //内网穿透
host: "0.0.0.0",
port: 8080,
https: false, // https:{type:Boolean}
open: true,
proxy: {
"/api": {
// target: "https://ds.cixincloud.com/songjiang-api",
target: "http://192.168.0.200:11999/",
// target: 'http://localhost:8201/',
// target: 'http://192.168.3.221/8201/',
changeOrigin: true,
pathRewrite: {
"^/api": ""
}
}
}
}
}