column-resizer icon indicating copy to clipboard operation
column-resizer copied to clipboard

[React-Babel] Unexpected token

Open Epick362 opened this issue 2 years ago • 2 comments

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?

Epick362 avatar Nov 06 '23 15:11 Epick362

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.

runjuu avatar Nov 12 '23 07:11 runjuu

Thank you for the quick response and solution @runjuu. I will verify in the coming days!

Epick362 avatar Nov 12 '23 18:11 Epick362