vue3+vite4生產(chǎn)環(huán)境production打包報錯:
NODE_ENV=production is not supported in the .env file. Only NODE_ENV=development is supported to create a development build of your project. If you need to set process.env.NODE_ENV, you can set it in the Vite config instead.
大致意思就是:
NODE_ENV=.ENV文件中不支持生產(chǎn)。僅支持NODE_ENV=開發(fā)來創(chuàng)建項目的開發(fā)構(gòu)建。如果需要設(shè)置process.env.NODE_env,則可以在Vite配置中進(jìn)行設(shè)置。
**
解決辦法:vite降級版本3+
**
如果有警告文章來源:http://www.zghlxwxcb.cn/news/detail-502743.html
build.terserOptions is specified but build.minify is not set to use Terser. Note Vite now defaults to use esbuild for minification. If you still prefer Terser, set build.minify to "terser".
那就把vite.config.js里面的minify換成:terser(別忘記install下載了)文章來源地址http://www.zghlxwxcb.cn/news/detail-502743.html
到了這里,關(guān)于vite4生產(chǎn)環(huán)境打包報錯NODE_ENV=production is not supported in the .env file.的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!