Giter Site home page Giter Site logo

Does it work in react 18? about blocks HOT 1 OPEN

celik75 avatar celik75 commented on May 25, 2024
Does it work in react 18?

from blocks.

Comments (1)

celik75 avatar celik75 commented on May 25, 2024

I tested myself and i got it working after some extra steps:

When installing u get some errors:
Could not resolve dependency:
npm ERR! peer react@"^16.13.1" from @blocks/[email protected]

By doing --legacy-peer-deps still works/installs.

To get work in webpack 5+ (webpack 5 has no polyfill anymore)i needed to change my webpack.config.js

Adding this to plugins []

      new webpack.ProvidePlugin({
        Buffer: ['buffer', 'Buffer'],
      }),
      new webpack.DefinePlugin({
        process: {env: {}}
      }),
  And this for the resolve []
fallback: {
        "fs": false,
        "tls": false,
        "net": false,
        "http": require.resolve("stream-http"),
        "https": false,
        "zlib": require.resolve("browserify-zlib") ,
        "path": require.resolve("path-browserify"),
        "stream": require.resolve("stream-browserify"),
        "util": require.resolve("util/"),
        "crypto": require.resolve("crypto-browserify"),
        "buffer": require.resolve("buffer")
      }

And added this to my project: (Problem webpack5+; undefined process fix)
https://stackoverflow.com/questions/70368760/react-uncaught-referenceerror-process-is-not-defined

"dependencies": {
   "buffer": "^6.0.3",
}
....

  "devDependencies": {
    "process": "^0.11.10",
    "react-error-overlay": "^6.0.9" //important see stack overflow link
  }

And then it should working on react 18+ and webpack 5+

from blocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.