Files
kxfx/vue.config.js
gcw_IJ7DAiVL 46c6b952fc fix bug
2025-10-27 10:48:12 +08:00

72 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const {defineConfig} = require('@vue/cli-service')
const postcssPxToViewport = require('postcss-px-to-viewport')
const path = require('path')
module.exports = defineConfig({
publicPath: './',
transpileDependencies: false, // 我们自己管,不让 CLI 插手
lintOnSave: false,
devServer: {client: {overlay: false}},
configureWebpack(config) {
// 调试
config.devtool = 'source-map'
// 别名
config.resolve.alias['@'] = path.resolve(__dirname, 'src')
/* 1. 追加 ini 规则 */
config.module.rules.push({
test: /\.ini$/,
use: 'raw-loader',
})
/* 2. 追加 ES5 规则(只转 src不转 node_modules */
// config.module.rules.push({
// test: /\.js$/,
// include: path.resolve(__dirname, 'src'),
// use: {
// loader: 'babel-loader',
// options: {
// presets: [
// [
// '@babel/preset-env',
// {
// targets: {ie: '11'}, // 强制 ES5
// corejs: 3,
// useBuiltIns: 'entry',
// },
// ],
// ],
// },
// },
// })
},
css: {
/* 你的 px-to-viewport 配置不动 */
loaderOptions: {
postcss: {
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,
}),
],
},
},
},
},
})