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

Unable to use with webpack v5 #24

Open
1 task done
ultralabsgev opened this issue Jun 16, 2022 · 3 comments
Open
1 task done

Unable to use with webpack v5 #24

ultralabsgev opened this issue Jun 16, 2022 · 3 comments

Comments

@ultralabsgev
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Explain what you did

I create react app and go step by step from the stretch

Expected behavior

can't start the project, getting 'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled)

Describe the bug

'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled)

Steps To Reproduce

npx create-react-app my-app --template typescript

npm install react-native-safe-area-context

npm i  @rneui/base @rneui/themed react-native-web react-native-vector-icons

npm i --dev @babel/plugin-proposal-class-properties customize-cra react-app-rewired

create config-overrides.js

const path = require('path');
const { override, addBabelPlugins, babelInclude } = require('customize-cra');

module.exports = override(
  ...addBabelPlugins('@babel/plugin-proposal-class-properties'),
  babelInclude([
    path.resolve(__dirname, 'node_modules/@rneui/base'),
    path.resolve(__dirname, 'node_modules/@rneui/themed'),
    path.resolve(__dirname, 'node_modules/react-native-vector-icons'),
    path.resolve(__dirname, 'node_modules/react-native-ratings'),
    path.resolve(__dirname, 'src'),
  ])
);

and run start

Screenshots

No response

Your Environment

`npx @rneui/envinfo`
  ```
    Output from `npx @rneui/envinfo` goes here.
  ```
@ultralabsgev
Copy link
Author

ultralabsgev commented Jun 16, 2022

guys update your documentation

@arpitBhalla arpitBhalla changed the title 'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled) Unable to use with webpack v5 Jun 16, 2022
@arpitBhalla arpitBhalla transferred this issue from react-native-elements/react-native-elements Jun 25, 2022
@PhungVanHoa
Copy link

I also got the same error

@PhungVanHoa
Copy link

@ultralabsgev add removeModuleScopePlugin() to config-overrides.js to solve this problem

const path = require("path");

const {
  override,
  addBabelPlugins,
  babelInclude,
  addWebpackAlias,
  addBabelPresets,
  removeModuleScopePlugin,
} = require("customize-cra");

module.exports = override(
  ...addBabelPlugins([
    "@babel/plugin-proposal-class-properties",
    {
      loose: true,
    },
  ]),
  ...addBabelPresets([
    "@babel/preset-env",
    {
      loose: true,
      targets: {
        browsers: ["> 1%", "last 2 versions"],
      },
      modules: "commonjs",
    },
  ]),
  removeModuleScopePlugin(),
  babelInclude(
    [
      path.resolve(__dirname, "node_modules/@rneui/base"),
      path.resolve(__dirname, "node_modules/@rneui/themed"),
      path.resolve(__dirname, "node_modules/react-native-vector-icons"),
      path.resolve(__dirname, "node_modules/react-native-ratings"),
      path.resolve(__dirname, "src"),
    ],
    addWebpackAlias({
      "react-native$": "react-native-web",
      "react-native-linear-gradient": "react-native-web-linear-gradient",
    })
  )
);

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

No branches or pull requests

2 participants