-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Support turbo #468
Support turbo #468
Conversation
|
@arlyon is attempting to deploy a commit to the Fuma Team on Vercel. A member of the Team first needs to authorize it. |
This is fine, I think mentioning it on the docs is enough (since types can be hard to deal with). |
Agree, maybe I can make the support for named imports like |
TY for the quick feedback. I will have a think about shiki over the weekend. I think the answer will be that user-defined transforms as inline functions are a no-go. You'd need to put them in a different package in your repo and import them. |
Could we throw a warning in that case? Or mark the support as experimental? My thinking is that we could get support out for the folks not using transformers (I'd have to assume the majority of folks) and look forward to the wider support in the future. |
Before Turbopack goes stable, I'll mark it as experimental. Maybe we can check the passed options in development mode, then throw the warnings if unserializable data detected. |
Just an idea: How about making a configuration file for the loaders, e.g. |
I cleaned some code and added the |
In Next.js, when you able the |
Hey @fuma-nama, do you have strong opinions regarding the syntax? Is the default export syntax I proposed ok in the mean time? Regarding #468 (comment) the intention is to have closures work ootb so we should be able to remove this 'experimental' syntax eventually. If you are on board I will rebase it and we can get it in :) |
My only concern is that the current setup still lacks flexibility, since most remark/rehype plugins are not designed to work on Turbo, people might want to pass unserialisable options. I'm taking reference from other similar things like Content Collections (or Contentlayer). If the loader can also bundle the configuration file with Turbopack, we might be able to "evaluate" the config file in runtime, and get unserialisable options working with our MDX loader. From what I understand, we cannot pass unserialisable options to loaders, because there's a Rust layer between next config and loaders. But if it's a JavaScript loader evaluating another JavaScript config, it should be possible. Sorry if it's too much change, highly appreciate your efforts to improve the build system ;) |
16c01e4
to
17746a6
Compare
8b4c251
to
3d1ec96
Compare
Now I'm working actively on Fumadocs MDX, a few news:
I'm trying to use esbuild to bundle the configuration file ( If Turbopack has its own functionality to load TypeScript file/config (e.g. a |
Closing in favour of #778 |
Hey, as promised, a draft PR! Comments welcome :)
Notes
['plugin-name', { ...options }]
syntaxproviderImportSource
. I believe this will be mandatory when using turbo because we can't rely on webpack aliasesQuestions:
Still need to write docs but will come back to that once these Qs are resolved.
Testing
Here is a page on my deployed site https://github.com/arlyon/litehouse/blob/main/site/content/docs/plugins/index.mdx?plain=1#L21-L22 that uses both a remark plugin and a rehype language.
You can validate the webpack side still works here https://litehouse.arlyon.dev/docs/plugins and if you'd like to clone and build the repo you should be able to do that fairly trivially but here is also a screenshot.