Ant Design Pro 打包到不同 dist 文件
Ant Design React About 578 words现象
因为本地开发时,会启动开发服务,Ant Design Pro会在dist中生成文件。
疑惑:Vite及原始的Webpack没见过会在开发环境往dist生成文件的。
解决
根据运行环境,指定不同outputPath。(如果在同一个文件夹中,当本地运行过开发环境,则本地打包时也在这个文件夹下)
config.ts
在config/config.ts文件中指定outputPath。
const PUBLIC_PATH: string = '/admin/';
export default defineConfig({
base: PUBLIC_PATH,
publicPath: PUBLIC_PATH,
outputPath: process.env.NODE_ENV === 'production' ? 'dist-prod' : 'dist-dev',
devtool: process.env.NODE_ENV === 'development' ? 'cheap-module-source-map' : false,
})
文档
Views: 6 · Posted: 2026-09-17
———         Thanks for Reading         ———
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...