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

Doesn't work with Next and SSR #69

Closed
maximelebreton opened this issue Dec 1, 2022 · 1 comment
Closed

Doesn't work with Next and SSR #69

maximelebreton opened this issue Dec 1, 2022 · 1 comment

Comments

@maximelebreton
Copy link

maximelebreton commented Dec 1, 2022

Hello @dev-juju, and thanks for your work!

I've found how to make your v3 plugin working on Next in client mode, with your code here:
#43 (comment)

and this on next.config.js:
{
//...
webpack(config, { webpack }) {
    config.plugins.push(
      new webpack.ProvidePlugin({
        React: "react",
      })
    )
    return config
  }
}

But it doesn't work in server mode: Error: React is not defined

I don't know if the reduced bundle size of v3 is only the drop of React,
but if if I'm ok ton include React as a dependency, is there a way to tell your plugin to call the React dependency and make SSR work again©?

"editorjs-react-renderer": "^3.5.0-beta.3"
"next": "12.3.1"
"react": "^18.2.0"

Thanks!

@dev-juju
Copy link
Owner

dev-juju commented Dec 2, 2022

@maximelebreton

Please update to V3.5.0, there are some issues with the beta versions

By default you shouldn’t have reference error client-side.
V3 cannot work server-side. Since you're using Nextjs your easiest option would be to turn off SSR with dynamic imports.

V4 will most probably work server-side but I can't give you an ETC on that at this time.

@dev-juju dev-juju closed this as completed Dec 6, 2022
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

2 participants