66 lines
1.5 KiB
JavaScript
66 lines
1.5 KiB
JavaScript
const {defineConfig} = require('@vue/cli-service')
|
|
const postcssPxToViewport = require('postcss-px-to-viewport')
|
|
const path = require('path') // 需要引入 path 模块
|
|
|
|
module.exports = defineConfig({
|
|
publicPath: './',
|
|
transpileDependencies: false,
|
|
lintOnSave: false,
|
|
devServer: {
|
|
client: {
|
|
overlay: false,
|
|
},
|
|
},
|
|
configureWebpack: (config) => {
|
|
//调试JS
|
|
config.devtool = 'source-map'
|
|
config.resolve = {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src'),
|
|
},
|
|
}
|
|
// 添加 .ini 文件处理规则
|
|
if (config.module && config.module.rules) {
|
|
config.module.rules.push({
|
|
test: /\.ini$/,
|
|
use: 'raw-loader'
|
|
})
|
|
} else {
|
|
config.module = {
|
|
rules: [
|
|
{
|
|
test: /\.ini$/,
|
|
use: 'raw-loader'
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
css: {
|
|
loaderOptions: {
|
|
postcss: {
|
|
postcssOptions: {
|
|
// 增加这一层 postcssOptions
|
|
plugins: [
|
|
postcssPxToViewport({
|
|
unitToConvert: 'px',
|
|
viewportWidth: 1920,
|
|
unitPrecision: 6,
|
|
viewportUnit: 'vw',
|
|
fontViewportUnit: 'vw',
|
|
propList: ['*'],
|
|
selectorBlackList: ['ignore-'],
|
|
minPixelValue: 1,
|
|
mediaQuery: false,
|
|
replace: true,
|
|
exclude: /(\/|\\)(node_modules)(\/|\\)/,
|
|
include: [],
|
|
landscape: false,
|
|
}),
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|