[React-Babel] Unexpected token
Hi, after installing this library (which looks perfect for my use case) inside a CRA project I am getting this error:
Failed to compile.
./node_modules/@column-resizer/core/dist/index.js 203:15
Module parse failed: Unexpected token (203:15)
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.
|
| var C = class {
> disposeFnSet = new Set();
| watchResizerEvent = (e, t, i) => {
| e === null || e === void 0 ? void 0 : e.addEventListener(t, i);
I am using react-scripts version 4 which is a bit older. Could this be due to that?
Hi @Epick362, sorry for the late response (I have no idea why GitHub didn't notify me about this issue).
It seems like react-scripts v4 cannot handle the class field declarations syntax properly. I've updated the compiler's config to make it compatible with react-scripts v4's babel configs. You can now update @column-resizer/react to version 1.3.0, and everything should work without any problems.
Thank you for the quick response and solution @runjuu. I will verify in the coming days!