react-arborist
react-arborist copied to clipboard
Module parse failed: Unexpected token (394:7)
Failed to compile.
./node_modules/react-arborist/dist/module.js 394:7
Module parse failed: Unexpected token (394:7)
File was processed with these loaders:
* ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| };
|
> el?.addEventListener("keydown", cb);
| return () => {
| el?.removeEventListener("keydown", cb);
I had the same problem. I figured out that webpack was not able to parse/resolve those arrow functions in this package and caused this problem. So removing those arrow function syntax or pass 'react-arborist' to babel loader in webpack config will solve this.
What is the environment you're using react-arborist in?
I have Node: 16.15.0 Webpack: 5.5.1 React: 17.0.1 Electron: 11.0.1 Typescript: 4.0.5
Do you think if we made the compile target a lower version of JavaScript, that would fix this?
I am not sure really.
Are you using "create-react-app"?
Upgrade @babel/preset-env in package.json to the most recent version.
Similar issue here. Not sure what to make of it.
v3.0.2
Edit: and apparently using the right babel-magic makes the error go away.
For people who have the same issue delete node_modules and change package.json https://github.com/facebook/create-react-app/issues/9468#issuecomment-694191642
I can probably fix this in the way I bundle the app. I need to lower the version of javascript that this package outputs.