fix: 编译cjs和css方式导致切换主题色异常

This commit is contained in:
TsMask
2024-12-19 21:06:51 +08:00
parent 2e91ab319f
commit c86c498ab9

View File

@@ -41,18 +41,6 @@ export default defineConfig(({ mode }) => {
}, },
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'], extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
}, },
css: {
preprocessorOptions: {
less: {
// DO NOT REMOVE THIS LINE
javascriptEnabled: true,
modifyVars: {
// hack: `true; @import 'ant-design-vue/dist/antd.variable.less'`,
// '@primary-color': '#eb2f96', // 全局主色
},
},
},
},
build: { build: {
target: 'esnext', // Use 'esnext' to support the latest features target: 'esnext', // Use 'esnext' to support the latest features
sourcemap: false, sourcemap: false,
@@ -68,12 +56,7 @@ export default defineConfig(({ mode }) => {
assetFileNames: 'assets/[name].[hash].[ext]', assetFileNames: 'assets/[name].[hash].[ext]',
manualChunks: { manualChunks: {
vendorVue: ['vue', 'vue-router', 'pinia'], vendorVue: ['vue', 'vue-router', 'pinia'],
vendorVuePlugins: [ vendorVuePlugins: ['vue-i18n', 'vue3-smooth-dnd', 'grid-layout-plus', '@vueuse/core'],
'vue-i18n',
'vue3-smooth-dnd',
'grid-layout-plus',
'@vueuse/core',
],
vendorAnt: ['ant-design-vue', '@ant-design/icons-vue'], vendorAnt: ['ant-design-vue', '@ant-design/icons-vue'],
vendorAntv: ['@antv/g6'], vendorAntv: ['@antv/g6'],
vendorEcharts: ['echarts'], vendorEcharts: ['echarts'],
@@ -111,7 +94,7 @@ export default defineConfig(({ mode }) => {
AntDesignVueResolver({ AntDesignVueResolver({
importStyle: false, importStyle: false,
resolveIcons: true, resolveIcons: true,
cjs: true, // 避免es模块打包缺失 cjs: false, // 统一使用es模块打包
}), }),
], ],
}), }),