1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
const resolve = (dir: string) => path.resolve(__dirname, dir); export default defineConfig(({ command, mode }) => { return { root: './', base: './', publicDir: resolve('public'), mode: 'production', cacheDir: 'node_modules/.vite', logLevel: 'warn', esbuild:{ jsxFactory: 'h', jsxFragment: 'Fragment' 以上为自定义JSX include:string | RegExp | (string | RegExp)[] exclude:string | RegExp | (string | RegExp)[] jsxInject:`import React from 'react'` } clearScreen: true, envDir: '', envPrefix: 'VITE_', appType: 'spa', assetsInclude: [''], plugins: [vue(),checker({typescript:true})], css:{}, resolve: { alias: { "@": resolve('src'), }, dedupe: [], conditions: [], mainFields: [], extensions: [], preserveSymlinks: false, }, }, json: { namedExports: true, stringify: false, }, server:{ .... proxy: { '/api': { target: 'http://127.0.0.1:2022', } } ... }, build: { manifest: false, target: 'modules', outDir: mode === 'staging' ? 'bundle' : 'dist', modulePreload: true, assetsDir: 'assets', assetsInlineLimit: 4096, chunkSizeWarningLimit: 500, emptyOutDir: true, watch: [''], sourcemap:false, .... }, ssr:{}, preview:{}, worker:{}, optimizeDeps:{}, })
|