Error vite Rollup failed to resolve import lodashthrottle from DWorkERPWebsrcviewsmainvarietyFirstCampcomponentpushAddvuevue&type=script&setup=true&langtsThis is most likely unintended because it can
这个错误是由于在你的代码中使用了lodash.throttle库,但是Rollup无法解析该导入。要解决这个问题,你可以将lodash.throttle库添加到build.rollupOptions.external配置中。
在你的vite.config.js文件中,找到build.rollupOptions配置项,如果没有则添加它。然后,在其中添加一个external属性,并将lodash.throttle添加到数组中,如下所示:
export default defineConfig({
// other config options...
build: {
rollupOptions: {
external: ['lodash.throttle']
}
}
})
保存文件并重新运行你的应用程序,应该能够解决这个错误。
原文地址: https://www.cveoy.top/t/topic/iJly 著作权归作者所有。请勿转载和采集!