2021-12-10 14:11:49 +08:00
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
import { resolve } from "path"
|
2021-12-14 15:53:30 +08:00
|
|
|
import { OUTPUT_DIR } from './build/constant'
|
2021-12-10 14:11:49 +08:00
|
|
|
|
|
|
|
function pathResolve(dir: string) {
|
|
|
|
return resolve(process.cwd(), '.', dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
base: "./",
|
|
|
|
resolve: {
|
|
|
|
alias: [
|
|
|
|
{
|
|
|
|
find: /\/#\//,
|
|
|
|
replacement: pathResolve('types') + '/',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: '@',
|
|
|
|
replacement: pathResolve('src') + '/',
|
|
|
|
}
|
|
|
|
],
|
|
|
|
dedupe: ['vue'],
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
preprocessorOptions: {
|
|
|
|
scss: {
|
|
|
|
javascriptEnabled: true,
|
2021-12-19 19:19:46 +08:00
|
|
|
additionalData: `@import "src/styles/common/style.scss";`,
|
2021-12-10 14:11:49 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
vue()
|
|
|
|
],
|
|
|
|
build: {
|
|
|
|
target: 'es2015',
|
|
|
|
outDir: OUTPUT_DIR,
|
|
|
|
terserOptions: {
|
|
|
|
compress: {
|
|
|
|
keep_infinity: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
brotliSize: false,
|
|
|
|
chunkSizeWarningLimit: 2000,
|
|
|
|
},
|
|
|
|
})
|