SyntaxError Unexpected token, expected "{"
See original GitHub issue你好,我使用typescript,想用father打包,结果一直报错: 报错如下:
版本:“father”: “^2.24.0”, .fatherrc.js配置如下
export default {
entry: 'src/index.js',
esm: 'rollup',
cjs: 'rollup',
};
tsconfig.json配置:
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"jsx": "react",
"esModuleInterop": true,
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
React — Syntax error: Unexpected token, expected
Well, you are getting error because you are defining the function like in a class, not in a function. Use a proper function...
Read more >Have a JavaScript Unexpected Token Error? Check Your Syntax
The JavaScript's parser expects tokens and symbols in a particular order, with relevant values or variables in between. Often, an Unexpected ...
Read more >Syntax Error: Unexpected token, expected "," (1:22) - MongoDB
Hi guys, I'm pretty new to MongoDB and just starting my journey learning different ways I can query my documents.
Read more >(syntax error) unexpected token, expected "}" - Replit
I believe this to be a syntax error, but I fail to find where it is. On line 49, there is said to...
Read more >React Native: Unexpected token ':'. Expected a ')' or a ',' after a ...
App shows red box with the error: SyntaxError: Unexpected token ':'. Expected a ')' or a ',' after a parameter declaration. No Stack ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dkvirus 嗯是不报错了也可以正常build成功.
tsconfig.json 增加 “skipLibCheck”: true,配置应该不需要yarn add @types/vfile-message
@sorrycc 逗号去掉,打包只会生成目录,不会生成打包文件,终端仍会报错:
报错信息字面意思
@types/vfile-message
这个包有问题,我尝试了它建议的两种方式,打包仍旧失败。yarn add @types/vfile-message
declare module 'vfile-message';
最终发现脚手架里的
@types/vfile-message
版本是 1.0.1,而 淘宝镜像网 查询@types/vfile-message
该包已废弃,vfile-message
包自身提供类型声明,最终我手动安装vfile-message
最新版本(2.0.2),打包成功。在 yarn.lock 找到依赖关系,顶层是 @umijs/fabric > eslint-plugin-markdown > unified > vfile > vfile-message。希望能从源头(@umijs/fabric)升级依赖包版本以解决该问题。