viclafouch / mui-color-input

📌 A color input designed for MUI (Material ui) V6 built with TinyColor
https://viclafouch.github.io/mui-color-input/
60 stars 20 forks source link

Module parse failed: Unexpected token (171:21) #3

Closed ihormaslov closed 1 year ago

ihormaslov commented 1 year ago

Describe the bug Installed package following instructions on this page https://viclafouch.github.io/mui-color-input/docs/getting-started/

Added component to my project and got this error

/<project_root>/node_modules/mui-color-input/dist/mui-color-input.es.js 171:21
Module parse failed: Unexpected token (171:21)
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.
|     }
| 
>     return t.current?.(...r);
|   }, []);
| }

Desktop (please complete the following information):

Additional context Versions of MUI packages we use in a project

"@mui/x-date-pickers": "^5.0.3",
"@mui/material": "^5.10.5",
"@mui/styles": "^5.10.3",
"@mui/lab": "^5.0.0-alpha.99",
"@mui/icons-material": "^5.10.3",
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
viclafouch commented 1 year ago

Hello !

Looks like you build config doesn't handle the optional chaining.

YuriAncelmo commented 1 year ago

Using react-scripts, you must to have the version WebPack at least 5. WebPack 4 doesn't recognize the optional chaining yet. I've updated the react-scripts to version 5.0.1 and the package works properlly.

Unfortunatelly websocket starts to crash, but this is another thing I must to correct.

Thank u for your develop is helping us so much