123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { defineConfig,loadEnv } from 'vite'
- import path from 'path'
- import vue from '@vitejs/plugin-vue'
- import requireTransform from 'vite-plugin-require-transform';
- import commonjs from '@rollup/plugin-commonjs';
- // https://vitejs.dev/config/
- export default defineConfig(configEnv =>{
- const viteEnv = loadEnv(configEnv.mode, process.cwd())
- return {
- base: viteEnv.VITE_BASE_URL,
- plugins: [
- vue(),
- commonjs(),
- requireTransform({
- fileRegex: /.js$|.vue$|.png$/
- }),
- ],
- 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/assets/[ext]/[name][hash].[ext]"
- }
- }
- }
- }
- })
|