blocks/blocks

Does it work in react 18?

celik75 opened this issue · 1 comments

Does it work in react 18?

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/react@0.0.63

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+