react-refresh-webpack-plugin icon indicating copy to clipboard operation
react-refresh-webpack-plugin copied to clipboard

Module parse failed: Unexpected token (typescript 4.9 satisfies)

Open jamiejakov opened this issue 2 years ago • 3 comments

Hi folks,

seems like react-refresh is failing to parse typescript's 4.9 new feature satisfies

Compiled with problems:

ERROR in ./src/app/pages/admin/pageRoutes.tsx 131:2

Module parse failed: Unexpected token (131:2)
File was processed with these loaders:
 * ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|     permissions: [Permissions.REDEEM_ITEMS]
|   }
> } satisfies Record<RouteNames, RouteData>);
| export var RouteLink = function RouteLink(props) {
|   var name = props.name,

Versions I'm running:

Plugin Version
@babel/core ^7.20.12
babel-loader ^9.1.2
typescript ^4.9.4
webpack ^5.75.0
@pmmmwh/react-refresh-webpack-plugin ^0.5.10

jamiejakov avatar Jan 12 '23 00:01 jamiejakov

What's required to get this fixed, is it just a dependency bump for something in this plugin itself? Trying to figure out if I'd be able to submit a patch for it.

jetpacmonkey avatar Mar 17 '23 15:03 jetpacmonkey

I believe this is a Babel problem, not on our side?

pmmmwh avatar Apr 12 '23 11:04 pmmmwh

@babel/core fixed it in 7.20.0, and babel-loader did in 9.0.0, but I'm still seeing errors from this plugin with those other libraries updated. I do see a dev dependency on an older version of babel for this library, maybe that's getting bundled in somewhere?

jetpacmonkey avatar Apr 21 '23 18:04 jetpacmonkey

This is a Babel problem - I've tested on the example repos with the satisfies keyword and it doesn't seem to break anymore.

pmmmwh avatar Jun 02 '24 23:06 pmmmwh