Commit eea349b2 by Jaxon

build(config): 调整构建配置与依赖,更新开发环境publicPath

- 修改vue.config.js的开发环境publicPath为/dj-scrm-wx-work-main-jaxon/
- 重构.postcssrc.js配置,移除调试日志并优化代码格式
- 升级autoprefixer至9.8.8,清理过时的autoprefixer@8、postcss-loader和postcss-pxtorem依赖
1 parent d23f7026
// // https://github.com/michael-ciniawsky/postcss-load-config module.exports = () => {
module.exports = ({file}) => { return {
console.log(file) plugins: {
// const Adaptive = /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|WebOS|Symbian|Windows Phone)/i, // Keep CSS prefix targets local to PostCSS for now; changing the global
// isMobile = (Adaptive.exec(avigator.userAgent)) // browserslist would also affect Babel transpilation targets.
return { "autoprefixer": {
plugins: { overrideBrowserslist: ["Android 4.1", "iOS 7.1", "Chrome > 31", "ff > 31", "ie >= 8"],
autoprefixer: { },
overrideBrowserslist: ['Android 4.1', 'iOS 7.1', 'Chrome > 31', 'ff > 31', 'ie >= 8'] "postcss-px-to-viewport": {
}, viewportWidth: 375, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750
'postcss-px-to-viewport': { unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除)
viewportWidth: 375, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750 viewportUnit: "vw", // 指定需要转换成的视窗单位,建议使用vw
unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除) selectorBlackList: [".ignore", ".hairlines", "ign-", "pc-"], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名
viewportUnit: 'vw', // 指定需要转换成的视窗单位,建议使用vw minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值
selectorBlackList: ['.ignore', '.hairlines', 'ign-', 'pc-'], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名 mediaQuery: false, // 允许在媒体查询中转换`px`
minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值
mediaQuery: false, // 允许在媒体查询中转换`px`
exclude: [/node_modules/] exclude: [/node_modules/],
} },
} },
} };
};
}
...@@ -12,12 +12,10 @@ ...@@ -12,12 +12,10 @@
"dev": "npm run serve" "dev": "npm run serve"
}, },
"dependencies": { "dependencies": {
"autoprefixer": "^8.0.0",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"dayjs": "^1.10.5", "dayjs": "^1.10.5",
"glsx-common": "^2.1.0", "glsx-common": "^2.1.0",
"lib-flexible": "^0.3.2", "lib-flexible": "^0.3.2",
"postcss-loader": "^4.3.0",
"sha1": "^1.1.1", "sha1": "^1.1.1",
"storejs": "^1.1.0", "storejs": "^1.1.0",
"vant": "^2.12.21", "vant": "^2.12.21",
...@@ -33,13 +31,13 @@ ...@@ -33,13 +31,13 @@
"@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0", "@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "~4.5.0",
"autoprefixer": "^9.8.8",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-plugin-import": "^1.13.0", "babel-plugin-import": "^1.13.0",
"babel-plugin-transform-remove-console": "^6.9.4", "babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^9.39.2", "eslint": "^9.39.2",
"eslint-plugin-format": "^1.2.0", "eslint-plugin-format": "^1.2.0",
"postcss-px-to-viewport": "^1.1.1", "postcss-px-to-viewport": "^1.1.1",
"postcss-pxtorem": "^5.1.1",
"sass": "^1.99.0", "sass": "^1.99.0",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"script-ext-html-webpack-plugin": "^2.1.4", "script-ext-html-webpack-plugin": "^2.1.4",
......
...@@ -27,7 +27,7 @@ function spritesmithFunction(data) { ...@@ -27,7 +27,7 @@ function spritesmithFunction(data) {
} }
module.exports = { module.exports = {
// 署应用包时的基本 URL。 vue-router hash 模式使用 // 署应用包时的基本 URL。 vue-router hash 模式使用
publicPath: IS_PROD ? "./" : "/dj-scrm-wx-work-main-cwq/", publicPath: IS_PROD ? "./" : "/dj-scrm-wx-work-main-jaxon/",
// publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-lwk/', // 署应用包时的基本 URL。 vue-router hash 模式使用 // publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-lwk/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: '/dj-scrm-wx-work-main/', // 署应用包时的基本 URL。 vue-router history模式使用 微信开发环境需打开 // publicPath: '/dj-scrm-wx-work-main/', // 署应用包时的基本 URL。 vue-router history模式使用 微信开发环境需打开
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!