king2088 / vue-3d-loader

VueJS and threeJS 3d viewer plugin
https://king2088.github.io/vue-3d-loader-docs
MIT License
222 stars 38 forks source link

安装好运行时报错 You may need an appropriate loader to handle this file type. #84

Closed TAKeke closed 9 months ago

TAKeke commented 10 months ago

版本1.2.18,使用的vue2 Module parse failed: Unexpected token (33250:5) You may need an appropriate loader to handle this file type. | var Sw = { | install: Mw, | ...ww | }, | Tw = Sw

king2088 commented 10 months ago

提供的信息不详细,无法得知你本地环境。 经过我本地测试,并未发现如此错误。本地测试使用的vue2版本为2.6.14,vue-3d-loader版本为1.2.18,run以及build都未出现问题。 鉴于你的错误,给出以下处理方法:

TAKeke commented 10 months ago

const ww = [bw] var Sw = { install: Mw, // ...ww }, 将...ww注释后,可以正常运行,ww类型为数组

TAKeke commented 10 months ago

提供的信息不详细,无法得知你本地环境。 经过我本地测试,并未发现如此错误。本地测试使用的vue2版本为2.6.14,vue-3d-loader版本为1.2.18,run以及build都未出现问题。 鉴于你的错误,给出以下处理方法:

  • 请删除node_modules文件夹
  • 重新npm install或yarn
  • 升级vue2版本

我将...ww注释后,可以正常运行,好像是类型出了问题,ww类型为数组

king2088 commented 10 months ago

提供的信息不详细,无法得知你本地环境。 经过我本地测试,并未发现如此错误。本地测试使用的vue2版本为2.6.14,vue-3d-loader版本为1.2.18,run以及build都未出现问题。 鉴于你的错误,给出以下处理方法:

  • 请删除node_modules文件夹
  • 重新npm install或yarn
  • 升级vue2版本

我将...ww注释后,可以正常运行,好像是类型出了问题,ww类型为数组

那是因为vue-3d-loader导致的还是你自己代码导致的?

TAKeke commented 10 months ago

提供的信息不详细,无法得知你本地环境。 经过我本地测试,并未发现如此错误。本地测试使用的vue2版本为2.6.14,vue-3d-loader版本为1.2.18,run以及build都未出现问题。 鉴于你的错误,给出以下处理方法:

  • 请删除node_modules文件夹
  • 重新npm install或yarn
  • 升级vue2版本

我将...ww注释后,可以正常运行,好像是类型出了问题,ww类型为数组

那是因为vue-3d-loader导致的还是你自己代码导致的?

我更改的是_vue-3d-loader@1.2.18@vue-3d-loader/dist/vue-3d-loader.umd.min.js 里的代码,我看了未压缩的代码应该是 const components = [vue3dLoader]; // vue install function const install = function (Vue) { // Register components components.map(component => { Vue.component(component.name, component); }); }; if (typeof window !== 'undefined' && window.Vue) { install(window.Vue); } / harmony default export / var src_0 = ({ install, ...components }); components是数组,应该是不能往对象里面复制的!

king2088 commented 10 months ago

你用的到底是vue2的什么版本?

TAKeke commented 10 months ago

你用的到底是vue2的什么版本?

2.7.14

king2088 commented 10 months ago

我也使用了vue@2.7.14,并未出现你说的错误,而你说的components是一个数组不能往对象中赋值,我并未将数组赋值到对象,而是将数组扁平化后再赋的值

king2088 commented 10 months ago

你可以回退到1.2.17版本试试会不会依然存在此问题。如果依然存在,应该是跟你的webpack配置有关,是否某些loader未引入导致的。

TAKeke commented 10 months ago

你可以回退到1.2.17版本试试会不会依然存在此问题。如果依然存在,应该是跟你的webpack配置有关,是否某些loader未引入导致的。

我试过回退到1.1.0依旧不行,将报错语句注释后可以正常运行,目前就先这样用吧