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
相关推荐
胡萝卜术1 天前
当大模型遇上浏览器:用 React + WebGPU 在前端跑通 DeepSeek-R1 的实战笔记
前端·javascript·面试
不好听6131 天前
Tailwind CSS 原子化 CSS 完全入门:为什么现代前端开发都在用?
前端·css
人间凡尔赛1 天前
Next.js 16 生产级实战:Cache Components + View Transitions 完整指南
开发语言·javascript·ecmascript
触底反弹1 天前
🔥 React 零基础入门(上):环境搭建 + JSX 深度解析
前端·react.js·typescript
why技术1 天前
分享一套我一直在使用的 AICoding 组合拳,小而美的典范。
前端·后端·ai编程
朦胧之1 天前
AI应用-消费流式输出
前端·javascript·ai编程
小林ixn1 天前
在浏览器跑通 15 亿参数大模型:我用 React + WebGPU 复刻了 DeepSeek-R1
前端·react.js·前端框架
Csvn1 天前
容器查询 @container 实战:告别无休止的媒体查询
前端
谷哥的小弟1 天前
TypeScript对象类型
javascript·typescript
稚南城才子,乌衣巷风流1 天前
函数:编程中的核心概念
开发语言·前端·javascript