12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import { defineConfig,loadEnv } from 'vite'
- import path from 'path'
- import vue from '@vitejs/plugin-vue'
- import requireTransform from 'vite-plugin-require-transform';
- // https://vitejs.dev/config/
- export default defineConfig(configEnv =>{
- const viteEnv = loadEnv(configEnv.mode, process.cwd())
- return {
- base: viteEnv.VITE_BASE_URL,
- plugins: [
- vue(),
- requireTransform({
- fileRegex: /.js$|.vue$/
- }),
- ],
- server: {
- host: '0.0.0.0',
- port: 9527,
- open: true
- },
- resolve: {
- alias: {
- "@": path.resolve(__dirname, "./src"),
- "~@": path.resolve(__dirname, "./src"),
- }
- },
- css: {
- preprocessorOptions: {
- scss: {
- additionalData: `@use "./src/styles/index.scss";`,
- },
- },
- },
- build: {
- outDir: viteEnv.VITE_APP_OUTDIR,
- minify: "esbuild",
- reportCompressedSize: false,
- chunkSizeWarningLimit: 2000,
- commonjsOptions: {
- ignoreTryCatch: false
- },
- rollupOptions: {
- output: {
- chunkFileNames: "static/js/[name][hash].js",
- entryFileNames: "static/js/[name][hash].js",
- assetFileNames: "static/[ext]/[name][hash].[ext]"
- }
- }
- }
- }
- })
|