17:57:38.451 [vite]: Rollup failed to resolve import "axios" from "E:/桌面/111/live-chat-master/uniapp/chatroomwx/pages/chatroom/chatroom.vue". 17:57:38.453 This is most likely unintended because it can break your application at runtime. 17:57:38.453 If you do want to externalize this module explicitly add it to 17:57:38.455 `build.rollupOptions.external`
时间: 2024-01-21 16:19:38 浏览: 140
这是一个 Rollup 打包错误,因为在你的 chatroom.vue 文件中引入了 axios 模块,但是 Rollup 在打包时无法解析它。你可以通过在你的 `vite.config.js` 文件中的 `build.rollupOptions.external` 中添加 axios 来显式地将其排除在打包之外,如下所示:
```javascript
export default {
build: {
rollupOptions: {
external: ['axios'] // 添加 axios 到 external 中
}
}
}
```
这样 Rollup 就会在打包时跳过对 axios 的处理,而是在运行时从外部获取它。
相关问题
11:34:05.798 [vite]: Rollup failed to resolve import "axios" from "E:/桌面/111/live-chat-master/uniapp/chatroomwx/pages/chatroom/chatroom.vue". 11:34:05.799 This is most likely unintended because it can break your application at runtime. 11:34:05.800 If you do want to externalize this module explicitly add it to 11:34:05.800 `build.rollupOptions.external`
这个错误提示是因为在你的 Chatroom.vue 文件中使用了 axios 模块,但是 Rollup 找不到该模块的引用。你需要将 axios 模块添加到 build.rollupOptions.external 中。
在你的 vite.config.js 文件中添加如下代码:
```javascript
export default {
build: {
rollupOptions: {
external: ['axios']
}
}
}
```
这样就可以解决这个问题了。
[vite]: Rollup failed to resolve import "@vueuse/core" from "src/layout/index.vue".
这个错误提示是因为在你的代码中引入了一个名为 "@vueuse/core" 的模块,但 Rollup 在构建时无法找到这个模块。
解决这个问题需要你检查一下你的代码中是如何引入 "@vueuse/core" 模块的。可能需要检查一下你的依赖是否正确安装,或者尝试使用绝对路径引入这个模块。
如果你使用的是 Vue CLI 创建的项目,可以尝试在项目根目录下执行以下命令来安装 "@vueuse/core":
```
npm install @vueuse/core
```
如果以上方法都无法解决问题,可以尝试升级 Rollup 的版本或者检查一下你的 Rollup 配置文件是否正确。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)