我正在开发一个使用create-react-app
创建的React应用程序,每当我启动应用程序时,都会出现以下错误:
./node_modules/scrambles/dist/esm/scrambles.js 37:39
Module parse failed: Unexpected token (37:39)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|
| async function getWorker() {
> const url = outsideStrategy.url.esm ?? outsideStrategy.url.cjs;
| const workerInstantiator = outsideStrategy.workerInstantiator.esm ?? outsideStrategy.workerInstantiator.cjs;
| let worker;
这是我的 package.json
中的依赖项:
"dependencies": {
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"@types/node": "^15.3.0",
"bulma": "^0.9.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icons": "^4.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"scrambles": "^0.1.13",
"typescript": "^4.2.4",
"web-vitals": "^1.1.2"
},
对于Babel我一点也不懂,从错误来看它似乎是问题的源头。我尝试了降级react-scripts
,但没有成功。非常感谢任何帮助;我已经花费几个小时试图修复这个问题。