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

使用swc-loader替换babel报错 #2057

Closed
danielmlc opened this issue Aug 26, 2023 · 1 comment
Closed

使用swc-loader替换babel报错 #2057

danielmlc opened this issue Aug 26, 2023 · 1 comment

Comments

@danielmlc
Copy link

ERROR in ./src/App.vue?vue&type=template&id=7ba5bd90&ts=true (./node_modules/swc-loader/src/index.js!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[1].rules[6].use[0]!./src/App.vue?vue&type=template&id=7ba5bd90&ts=true)
Module build failed (from ./node_modules/swc-loader/src/index.js):
Error:
× Expected ',', got ':'
╭─[E:\project\webpack\swc-test\src\App.vue:6:1]
6 │ _hoisted_2
7 │ ]
8 │
9 │ export function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {
· ─
10 │ return (_openBlock(), _createElementBlock("div", _hoisted_1, _hoisted_3))
11 │ }
╰────

Caused by:
Syntax Error
@ ./src/App.vue?vue&type=template&id=7ba5bd90&ts=true 1:0-245 1:0-245

demo地址: https://github.com/danielmlc/swc-test

@haoqunjiang
Copy link
Member

需要配置 .swcrc 以支持 TypeScript 语法解析:
https://swc.rs/blog/swc-1#typescript-support

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