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
Next.js cannot compile with turbo when lowlight is used #65106
Comments
We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate. Why was this issue marked with the
|
Seems you've copy-pasted the sandbox and didn't add any code into it, in the future please double check that the provided reproduction actually reproduces the issue. |
Here's a sandbox of the reproduction steps working fine on |
Sorry for the wrong code sandbox link. Without adding |
Thank for the reproduction! Was able to figure out what the problem is based on that. So the problem is that webpack resolving in this particular case is incorrect, it allows you to import modules from a place that your application code shouldn't have access to, namely the node_modules of a nested dependency. Turbopack has a more correct resolving that matches closer to what Node.js does. If you try running the Node.js repl you'll notice that Looking at the docs for the package you'll want to do something like this instead as lowlight includes the highlight.js data: import { createLowlight, common } from "lowlight";
const lowlight = createLowlight();
lowlight.register({ typescript: common.typescript }); Lowlight also exports |
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/blazing-wood-go8s7s?file=%2Fapp%2Fpage.tsx%3A3%2C10https://codesandbox.io/p/devbox/old-resonance-lv6j3x
To Reproduce
--turbo
defined in package.json)npm run dev
Failed to compile
Current vs. Expected behavior
I expect it compile without error, because it works correctly when dev server is run without turbopack (without
--turbo
flag). But it is currently failing with module not found. I noticed--turbo
works if I includehighlight.js
as dependency.Provide environment information
Which area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
The mvp is based on the instruction of MantineRichEditor Example:
https://mantine.dev/x/tiptap/#code-highlight
PACK-3017
The text was updated successfully, but these errors were encountered: