Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module parse failed: Unexpected token. You may need an additional loader to handle the result of these loaders. #374

Open
utopictown opened this issue May 21, 2024 · 0 comments

Comments

@utopictown
Copy link

utopictown commented May 21, 2024

hello, i got transpiling error below on my react app configured with react-app-rewired

Module parse failed: Unexpected token (2126:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   }
|   class Q {
>     _config;
|     hashHistory;
|     constructor({

i have tried adding some babel plugins in config-overrides.js

...
const { override, fixBabelImports, addLessLoader, addWebpackAlias, addBabelPlugin } = require('customize-cra')

module.exports = override(
  ...,
  addBabelPlugin("@babel/plugin-transform-private-property-in-object"),
  addBabelPlugin("@babel/plugin-transform-class-properties"),
  addBabelPlugin("@babel/plugin-transform-private-methods")
)

and include them in .babelrc plugins list

{
"presets": [
  "@babel/preset-env",
  "@babel/preset-react"
],
"plugins": [
  "object-to-json-parse", 
  "styled-components",
  "@babel/plugin-transform-private-property-in-object",
  "@babel/plugin-transform-class-properties", 
  "@babel/plugin-transform-private-methods"
]
}

here are some devDependencies that might be useful

    "@babel/plugin-transform-class-properties": "^7.24.1",
    "@babel/plugin-transform-private-methods": "^7.24.1",
    "@babel/plugin-transform-private-property-in-object": "^7.24.5",
    "@babel/preset-env": "^7.24.5",
    "customize-cra": "^0.9.1",
    "react-app-rewired": "^2.1.5",
    "react-scripts": "^3.4.4",

pubnub version: "^8.1.0"
node version: v18.20.2

can anyone please help figuring this out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant