vue安装three之后报错You may need an appropriate loader to handle this file type

前端vue项目安装three之后,npm run dev报错

复制代码
error  in ./node_modules/three/build/three.core.js

Module parse failed: Unexpected token (3030:8)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| class Vector2 {
| 
> 	static {
| 
| 		/**

如下图所示:

报错原因

‌Three.js 版本过高‌:从 r125+ 开始,Three.js 全面采用 ES6 类语法,而默认 Webpack 配置不处理 node_modules/three/ 中的现代 JS 语法。

解决报错

降低three的版本就不再报错了

复制代码
npm install three@0.176
相关推荐
threerocks18 分钟前
什么?我连 A2A、MCP 都没学会,现在又来了 AG-UI、A2UI.
前端·aigc·ai编程
牛奶1 小时前
如何自己写一个浏览器插件?
前端·chrome·浏览器
亿元程序员1 小时前
为什么Cocos都4.0了还有人用2.x?
前端
MomentYY2 小时前
AI 到底是“懂”,还是在“猜”?
前端·人工智能·ai编程
鹏毓网络科技2 小时前
Cursor Rules 文件配置实战:3 个隐藏参数让我每月少写 40% 样板代码
前端·github
没烦恼3012 小时前
无痕模式下 HTTP\-First 拦截引发的“页面刷新”误判
前端
ZhengEnCi2 小时前
Q02-Vue-React-index.html完全指南
vue.js·react.js·html
文心快码BaiduComate2 小时前
从个人提效到组织提效:Comate辅助构建自我进化的AI研发系统
前端·程序员
hunterandroid2 小时前
Compose 状态管理:remember、rememberSaveable 与状态提升
前端
星栈3 小时前
Dioxus 接数据库最容易写歪的 3 个地方:sqlx + SQLite 怎么接才顺
前端·rust·前端框架