Skip to content

[TextField] Module parse failed: Unexpected token #20812

@mhienle

Description

@mhienle

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    not plannedThe problem seems valid, but we don't intend to fix it (won't fix).

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions