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

Supporting Preact with Next.js v12 #49

Closed
neeraj3029 opened this issue Nov 16, 2021 · 4 comments
Closed

Supporting Preact with Next.js v12 #49

neeraj3029 opened this issue Nov 16, 2021 · 4 comments

Comments

@neeraj3029
Copy link

With the recent release of next v12, using preact with Next.js seems a bit difficult. I am looking for some workarounds to accomplish this. Read more here: vercel/next.js#31240

@neeraj3029 neeraj3029 changed the title Support for Next.js v12 Supporting Preact with Next.js v12 Nov 16, 2021
@kidonng
Copy link

kidonng commented Nov 16, 2021

Interestingly, just installing scheduler is enough to upgrade one project to Next.js 12 (denoland/doc_website#256) but not on a similar project (denoland/dotland#1942):

$ next build
warn  - You have enabled experimental feature(s).
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use them at your own risk.

info  - Checking validity of types  
warn  - The Next.js plugin was not detected in your ESLint configuration. See https://nextjs.org/docs/basic-features/eslint#migrating-existing-config
info  - Creating an optimized production build  
info  - Compiled successfully

> Build error occurred
file:///workspaces/dotland/node_modules/react-dom/server.mjs:2
export { default } from 'preact/compat/server';
         ^^^^^^^
SyntaxError: The requested module 'preact/compat/server' does not provide an export named 'default'
    at ModuleJob._instantiate (internal/modules/esm/module_job.js:121:21)
    at async ModuleJob.run (internal/modules/esm/module_job.js:166:5)
    at async Loader.import (internal/modules/esm/loader.js:178:24) {
  type: 'SyntaxError'
}

EDIT: yup, I find out it's because there are several imports from react-dom in the code.

@kittipongint
Copy link

Like @kidonng said, Just install scheduler is enough to let next.js 12.0.4 work with preact.js for me.

@neeraj3029
Copy link
Author

Yes, that's indeed a potential workaround. But, I think it was wondering if we could solve this problem with this plugin :)

@neeraj3029
Copy link
Author

Fixed with: vercel/next.js#31264

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

3 participants