| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { defineConfig, loadEnv } from '@rsbuild/core'
- import { createRsbuildPlugins } from './config/plugins/index'
- // import proxy from './config/proxy'
- const { publicVars, parsed } = loadEnv({
- prefixes: ['VUE_APP_'],
- })
- const isBuild = process.env.NODE_ENV === 'production'
- const shouldDropConsole = !parsed.VUE_APP_DROP_CONSOLE
- ? isBuild
- : parsed.VUE_APP_DROP_CONSOLE === 'true'
- export default defineConfig({
- /* 入口文件 */
- source: {
- entry: {
- index: './src/main',
- },
- /* 注入环境变量 */
- define: publicVars,
- },
- html: {
- template: 'public/index.html',
- title: parsed.VUE_APP_TITLE,
- },
- server: {
- port: 9906,
- // proxy: {
- // '/v1/admin': {
- // target: 'http://192.168.10.31:8080',
- // changeOrigin: true,
- // },
- // },
- },
- tools: {
- rspack: {
- ignoreWarnings: [/Conflicting order/],
- experiments: {
- nativeWatcher: true,
- },
- },
- },
- plugins: createRsbuildPlugins(isBuild),
- output: {
- polyfill: 'entry',
- cleanDistPath: isBuild,
- legalComments: 'none',
- },
- performance: {
- printFileSize: {
- compressed: false,
- },
- /* 打包时候移除console */
- removeConsole: shouldDropConsole,
- },
- splitChunks: {
- preset: 'default',
- maxInitialSize: 3000 * 1024,
- },
- })
|