[TextField] Module parse failed: Unexpected token
See original GitHub issueAfter updating to v4.9.12, I get the following error:
ERROR in ./node_modules/@material-ui/core/es/TextField/TextField.js 109:46
Module parse failed: Unexpected token (109:46)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| if (label) {
> const displayRequired = InputLabelProps?.required ?? required;
| InputMore.label = /*#__PURE__*/React.createElement(React.Fragment, null, label, displayRequired && '\u00a0*');
| }
@ ./node_modules/@material-ui/core/es/TextField/index.js 1:0-38 1:0-38
@ ./node_modules/@material-ui/core/es/index.js
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
The above error occurs when I start webpack-dev-server. It disappears when I locally change the line
const displayRequired = InputLabelProps?.required ?? required;
to
const displayRequired = InputLabelProps ? InputLabelProps.required : required;
in TextField.js.
Expected Behavior 🤔
The error should not occur.
Steps to Reproduce 🕹
Context 🔦
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.9.12 |
React | 16.13.1 |
TypeScript | 3.8.3 |
Related to #20715
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12 (6 by maintainers)
Top Results From Across the Web
[Material-UI TextField] Module parse failed: Unexpected token
After npm install and npm run build I get this error [build:prod] ERROR in ../node_modules/@material-ui/core/es/TextField/TextField.js ...
Read more >Error Module parse failed: Unexpected token (357:30)
I was working on this project on saturday i stopped and went home now today i.e monday i started this project and it...
Read more >Module parse failed: Unexpected token (1:0) - Laracasts
Hello , After running npm run watch I see this error : ERROR in ./resources/js/components/irp/admin/EditGroup.vue 1:0 Module parse failed: Unexpected token ...
Read more >Frequently asked questions — Vuetify
I'm seeing Error Module parse “failed”. Unexpected token in the terminal. Is there a codepen template with router? How do I extend Vuetify...
Read more >module parse failed: unexpected token (1:0) you may need an ...
1 Answer. Apparently it happened because you have two module properties in the webpack config object. Given JS objects can only hold one...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mhienle The answer is in https://material-ui.com/guides/minimizing-bundle-size/#ecmascript, this is meant for advanced cases. Your question makes me believe you are not on the targeted audience for using the /es distribution.
@Farbod29 Note that the
/es/
folder is only meant for advanced use cases.