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

打包报错,请问是否有 CommonJS 语法的包? #2

Open
liuende501 opened this issue Aug 22, 2023 · 2 comments
Open

打包报错,请问是否有 CommonJS 语法的包? #2

liuende501 opened this issue Aug 22, 2023 · 2 comments

Comments

@liuende501
Copy link

liuende501 commented Aug 22, 2023

报错信息如下

error  in ./node_modules/afsm/index.js

Module parse failed: Unexpected token (7:12)
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
| // 中间过渡状态
| export class MiddleState {
>     oldState;
|     newState;
|     action;

 @ ./node_modules/trtc-sdk-v5/trtc.esm.js 9:6977-7023 9:7023-7069 9:7069-7115 15:1720-1722 15:6664-6666 15:6717-6719 15:6792-6794 15:14756-14758 15:21003-21005 15:21009-21011 15:28243-28245 15:31135-31137 15:31138-31140 15:31197-31199 15:31366-31368 15:31790-31792 15:58283-58329 15:59386-59388 15:59389-59391 15:59621-59623 15:59643-59645 27:27582-27610 27:61961-61963 27:67288-67334 29:38410-38412 29:38421-38423 29:38472-38474
 @ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/trtcTest.vue?vue&type=script&lang=js&
 @ ./src/views/trtcTest.vue?vue&type=script&lang=js&
 @ ./src/views/trtcTest.vue
 @ ./src/router.js
 @ ./src/main.js
 @ multi ./src/main.js

查询后发现是 CommomJS 和 ESM 的语法区别, 目前用的是 vue 脚手架搭建的 CommomJS 语法工程, 如何使用

@langhuihui
Copy link
Owner

嗯,最新版已经修复了,这个是 tsc 的时候没有指定 target 导致输出了太超前的格式

@liuende501
Copy link
Author

好的 谢谢

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

2 participants