You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.0 KiB
33 lines
1.0 KiB
import { defineConfig, loadEnv } from 'vite' |
|
const { resolve } = require('path') |
|
import createVitePlugins from './vite/plugins' |
|
import { OUTPUT_DIR } from '../../build/constant' |
|
|
|
// https://vitejs.dev/config/ |
|
export default ({ mode, command }) => { |
|
const root = process.cwd() |
|
const env = loadEnv(mode, root) |
|
const { VITE_APP_BASE } = env |
|
return defineConfig({ |
|
root, |
|
base: VITE_APP_BASE, |
|
resolve: { |
|
alias: { |
|
'~': resolve(__dirname, './'), |
|
"@": resolve(__dirname, "./src"), |
|
"components": resolve(__dirname, "./src/components"), |
|
"styles": resolve(__dirname, "./src/styles"), |
|
"utils": resolve(__dirname, "./src/utils"), |
|
} |
|
}, |
|
plugins: createVitePlugins(env, command === 'build'), |
|
build: { |
|
outDir: OUTPUT_DIR |
|
}, |
|
css: { |
|
// 跟主项目的postcss.config.js起冲突,关闭后面需要使用可以在bigscreen-design项目下加postcss.config.js |
|
// 或者直接在这里配置,优先级 vite.config.js > postcss.config.js |
|
postcss: {} |
|
} |
|
}) |
|
}
|
|
|