vite.config.js配置如下:
import legacy from '@vitejs/plugin-legacy'
import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
export default defineConfig({
plugins: [
uni(),
legacy({
targets: ['defaults', 'not IE 11','chrome > 44']
})
]
})
运行到基座APP报如下错误
error during build:
11:07:01.118 Error: @vitejs/plugin-legacy does not support library mode.
11:07:01.122 at Object.configResolved (D:\soft\src\HBuilderX.3.5.3.20220729\HBuilderX\plugins\uniapp-cli-vite\node_modules\@vitejs\plugin-legacy\index.js:179:15)
11:07:01.126 at D:\soft\src\HBuilderX.3.5.3.20220729\HBuilderX\plugins\uniapp-cli-vite\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:61635:127
11:07:01.127 at Array.map (<anonymous>)
11:07:01.131 at resolveConfig (D:\soft\src\HBuilderX.3.5.3.20220729\HBuilderX\plugins\uniapp-cli-vite\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:61635:35)
11:07:01.131 at processTicksAndRejections (internal/process/task_queues.js:97:5)
11:07:01.137 at async doBuild (D:\soft\src\HBuilderX.3.5.3.20220729\HBuilderX\plugins\uniapp-cli-vite\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:41564:20)
11:07:01.142 at async build (D:\soft\src\HBuilderX.3.5.3.20220729\HBuilderX\plugins\uniapp-cli-vite\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:41552:16)
11:07:01.146 at async buildApp (D:\soft\src\HBuilderX.3.5.3.20220729\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\vite-plugin-uni\dist\cli\build.js:100:25)
11:07:01.151 at async CAC.runDev (D:\soft\src\HBuilderX.3.5.3.20220729\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\vite-plugin-uni\dist\cli\action.js:28:30)
运行到浏览器是可以的。
1***@163.com
我也遇到这问题,请问怎么解决的
3051813192
QQ请联系,红包奖励
2023-06-06 16:30