Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module parse error #72

Closed
nouman91 opened this issue Jan 10, 2023 · 7 comments
Closed

Module parse error #72

nouman91 opened this issue Jan 10, 2023 · 7 comments

Comments

@nouman91
Copy link

I am trying to using the library in an existing project bootstrapped with craco and create-react-app. Following is the error I get at the compile time.

./node_modules/react-resizable-panels/dist/react-resizable-panels.module.js 141:23
Module parse failed: Unexpected token (141:23)
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.
|   if (state) {
|     const key = $6ff1a22b27cc039d$var$getSerializationKey(panels);
>     return state[key] ?? null;
|   }
|

Package.json details:
"@craco/craco": "^6.0.0", "react": "^17.0.2", "react-dom": "^17.0.2",

Please let me know if you need more details.

@bvaughn
Copy link
Owner

bvaughn commented Jan 10, 2023

Duplicate of #67

Should find a solution here:
facebook/create-react-app#9468 (comment)

Good luck! 😄

@bvaughn bvaughn closed this as completed Jan 10, 2023
bvaughn added a commit that referenced this issue Jan 10, 2023
Removed nullish coalescing operator (??)
@bvaughn
Copy link
Owner

bvaughn commented Jan 10, 2023

FYI, I removed the nullish coalescing operator in v0.0.31 because the trivial benefit it provided didn't seem worth causing headaches for create-react-app users.

@nouman91
Copy link
Author

Thank you for your prompt response. After a day of fiddling around I could not get it to work here is error which I am getting.

`Failed to compile.

./node_modules/react-resizable-panels/dist/react-resizable-panels.module.js 316:38
Module parse failed: Unexpected token (316:38)
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.
    | const handles = $f30c804b5fe6cc1a$export$ae14931f0a0256a3(groupId);
    | const index = handles.indexOf(handle);

const idBefore = panelsArray[index]?.id || null;
| const idAfter = panelsArray[index + 1]?.id || null;
| return [idBefore, idAfter];`

@bvaughn
Copy link
Owner

bvaughn commented Jan 11, 2023

Sorry @nouman91. You'll probably need to look at Stack Overflow or somewhere else for help with the CRA Webpack configuration. That's not something I have the time or knowledge to support.

@nouman91
Copy link
Author

Yeah I understand! Thank you!

@nouman91
Copy link
Author

I was able to solve it, if someone is else is stuck into same issue with craco. Following is the package you need
https://www.npmjs.com/package/craco-babel-loader

@bvaughn
Copy link
Owner

bvaughn commented Jan 18, 2023

By the way, if you update to 0.0.35– this module should now work with CRA without any additional configuration changes.
https://github.com/bvaughn/react-resizable-panels/releases/tag/v0.0.35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants