初始化
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* @Author: 王枫叶
|
||||
* @Date: 2020-07-20 20:48:00
|
||||
* @LastEditors: 王枫叶
|
||||
* @LastEditTime: 2020-10-05 17:22:53
|
||||
*/
|
||||
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
|
||||
// .BundleAnalyzerPlugin;
|
||||
const CompressionPlugin = require("compression-webpack-plugin") // webpack打包时,gzip压缩
|
||||
module.exports = {
|
||||
configureWebpack: {
|
||||
plugins: [
|
||||
// new BundleAnalyzerPlugin(),
|
||||
new CompressionPlugin({
|
||||
test: /\.js$|\.css$|\.html$|\.mp4$/, //匹配文件名
|
||||
threshold: 10240, //对超出10k对数据进行压缩
|
||||
deleteOriginalAssets: false //是否删除文件
|
||||
})
|
||||
]
|
||||
},
|
||||
devServer: {
|
||||
compress: true,
|
||||
disableHostCheck: true,
|
||||
open: false,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
errors: true
|
||||
},
|
||||
proxy: {
|
||||
"/plm": {
|
||||
target: `https://91pornldy.ruishengces.com`, // 测试服
|
||||
// target: `/`, //正式服/
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
secure: false,
|
||||
pathRewrite: {
|
||||
["^" + process.env.VUE_APP_WEB_API]: process.env.VUE_APP_WEB_API
|
||||
}
|
||||
},
|
||||
"/dcserv": {
|
||||
target: "https://api.shuifeng.cc",
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/dcserv/, ""),
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
pwa: {
|
||||
name: "",
|
||||
short_name: "",
|
||||
iconPaths: {
|
||||
favicon32: "favicon.ico",
|
||||
favicon16: "favicon.ico",
|
||||
appleTouchIcon: "favicon.ico",
|
||||
maskIcon: "favicon.ico",
|
||||
msTileImage: "favicon.ico"
|
||||
}
|
||||
},
|
||||
|
||||
lintOnSave: true,
|
||||
|
||||
css: {
|
||||
extract: process.env.NODE_ENV == 'production' ? {
|
||||
ignoreOrder: true
|
||||
} : false,
|
||||
loaderOptions: {
|
||||
postcss: {
|
||||
plugins: [
|
||||
require("postcss-plugin-px2rem")({
|
||||
rootValue: 37.5, // 换算基数, 默认100 ,这样的话把根标签的字体规定为1rem为50px,这样就可以从设计稿上量出多少个px直接在代码中写多上px了。
|
||||
unitPrecision: 3, // 单位转换后保留的精度
|
||||
unitToConvert: 'px', // 需要转换的单位
|
||||
// propWhiteList: [], //默认值是一个空数组,这意味着禁用白名单并启用所有属性。
|
||||
// propBlackList: [], //黑名单
|
||||
exclude: false, // 默认false,可以(reg)利用正则表达式排除某些文件夹的方法,例如/(node_module)/ 。如果想把前端UI框架内的px也转换成rem,请把此属性设为默认值/(node_module)/
|
||||
selectorBlackList: ['pcm'], //要忽略并保留为px的选择器
|
||||
// ignoreIdentifier: false, //(boolean/string)忽略单个属性的方法,启用ignoreidentifier后,replace将自动设置为true。
|
||||
// replace: true, // (布尔值)替换包含REM的规则,而不是添加回退。
|
||||
mediaQuery: false, // (布尔值)允许在媒体查询中转换px。
|
||||
minPixelValue: 0.5, // 设置要替换的最小像素值(3px会被转rem)。 默认 0
|
||||
viewportUnit: 'vw', // 希望使用的视口的单位
|
||||
fontViewportUnit: 'vw', // 字体使用的视口单位
|
||||
replace: true, // 是否直接更换属性值,而不添加备用属性
|
||||
propList: ['*'], // 能转换成vw的属性列表,传入csss属性或者通配符
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user