Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-cli 4.5项目导入出错 #6

Open
1xu1 opened this issue Oct 17, 2021 · 4 comments
Open

vue-cli 4.5项目导入出错 #6

1xu1 opened this issue Oct 17, 2021 · 4 comments

Comments

@1xu1
Copy link

1xu1 commented Oct 17, 2021

导入方式:
import RaindropFX from "raindrop-fx";

错误信息:

error  in ./node_modules/raindrop-fx/dist/index.js

Module parse failed: Unexpected token (396:4320)
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
|     vWorldPos = (uTransformM * vec4(aPos, 1)).xyz;\r
|     vSize = aSize;\r`
······
| /*! *****************************************************************************
| Copyright (C) Microsoft. All rights reserved.

 @ ./node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/ts-loader??ref--14-2!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/components/background/Background.vue?vue&type=script&lang=ts 6:0-37 35:25-35

这是咋回事啊大佬

@SardineFish
Copy link
Owner

是 NPM 上的版本么?

@1xu1
Copy link
Author

1xu1 commented Oct 18, 2021

是的,是npm安装的,版本是1.08

@SardineFish
Copy link
Owner

初步认定问题源于代码中使用的 ?. 运算符无法在 Vue 默认的项目构建设置下使用,鄙人才学疏浅,对 Vue 的构建配置了解不多,尚未能成功在 Vue 构建流中加入对 ?. 的支持。由于这个项目基于 esbuild 和 typescript,目前还没找到合适的解决方案在构建流中引入 babel,项目里诸如 ?. 这类 ESNext 的语法特性用的还不少(

可能需要额外抽时间对项目重构一下,如果你那边有找到相关解决方案,可以同步到这个 Issue 下

@sangyoo91
Copy link

I'm having the same problems with vue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants