马宇豪
2023-08-14 3b9b33c2b5ab555696e1012ed1e35446c8052786
vite.config.ts
@@ -1,7 +1,7 @@
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
import { defineConfig, loadEnv, ConfigEnv } from 'vite';
import postCssPxToRem from "postcss-pxtorem"
const pathResolve = (dir: string): any => {
    return resolve(__dirname, '.', dir);
};
@@ -57,18 +57,18 @@
        css: {
            postcss: {
                plugins: [
                    {
                        postcssPlugin: 'internal:charset-removal',
                        AtRule: {
                            charset: (atRule) => {
                                if (atRule.name === 'charset') {
                                    atRule.remove();
                                }
                    postCssPxToRem({
                        rootValue: 37.5, // 1rem的大小(控制1rem的大小  点位:px)
                        propList: ["*"], // 需要转换的属性,这里选择全部都进行转换
                        exclude: (e:any) => { // 不包含
                            if (/src(\\|\/)views(\\|\/)bigScreen(\\|\/)components(\\|\/)screen/.test(e)||/src(\\|\/)views(\\|\/)loginPage(\\|\/)loginPage/.test(e)||/src(\\|\/)views(\\|\/)loginPage(\\|\/)component(\\|\/)accountLogin/.test(e)) { // 指定生效页面(正则)
                                return false;
                            }
                            return true;
                        }
                    }
                ]
            }
                    }),
                ],
            },
        },
        define: {
            __VUE_I18N_LEGACY_API__: JSON.stringify(false),