question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[TextField] Module parse failed: Unexpected token

See original GitHub issue

After 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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
oliviertassinaricommented, Apr 28, 2020

@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.

0reactions
oliviertassinaricommented, Apr 5, 2021

@Farbod29 Note that the /es/ folder is only meant for advanced use cases.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found