Closed vpontis closed 2 years ago
Also now that next.js 13 has introduced turbopack as the new successor to Webpack i'm wondering if next-transpile-modules will keep able to transpile modules, even because at the moment turbopack is available only on dev mode but i guess in the near future will be the default next.js bundler.
Hello there, I haven't fully watched Next.js conf, but I roughly saw the new bundler announcement.
I should definitely have a look at this, and see if we can access (and edit!) the Turbopack config from next.config.js
. If yes, I am pretty we should be able to make it work. :)
Would have been cool to have a heads up from the official team prior to the release though.
Would have been cool to have a heads up from the official team prior to the release though
This. Even better they should make you a hiring proposal 🙂, i dont understand why while next.js keeps building (or acquiring) its own tools (especially about monorepos) we still need to use third parties plugins for have a real monorepo architecture.
Thank you @martpie! This is such an awesome package :)
Hey, just a heads up Next.js 13 has a dedicated option called transpilePackages
that is somewhat equivalent to next-transpile-modules, you can check the docs here: https://beta.nextjs.org/docs/api-reference/next.config.js#transpilepackages. I've sent a message to the docs team to update the stable docs and upgrade guide to mention this config as well as it applies to both pages
and app
.
I think next-transpile-modules
can now be deprecated (but it's not my decision ofcourse), @martpie wanted this as a built-in option for a long time and we made it happen 🙏
Thanks for maintaining this package for quite some time @martpie, it had quite some usage which is why the built-in option made sense. Another reason is that Next.js 13 changes the compilation of packages/modules quite a bit to support React Server Components.
Hi Tim!
That's awesome to hear, I gotta try this new option, and if it's a perfect replacement, then we should definitely (and happily!) deprecate next-transpile-modules
🥳
in my case the new transpilePackages
option alone was not enough, seeing errors that a custom loader is needed. But using both transpilePackages
and next-transpile-modules
fixed the issue
module.exports = withTM({
experimental: { transpilePackages: ["package1", "package2"] },
});
Some update: got a lot on my plate for work right now, but I'll be working on that this weekend. Sorry for the wait, we're all excited about Next.js 13 😊
in my case the new transpilePackages option alone was not enough, seeing errors that a custom loader is needed.
This is not super helpful in resolving what you ran into, can you create a reproduction and open an issue on the Next.js repository.
cf. #281 for wip.
@Fawwaz-2009 https://github.com/martpie/next-transpile-modules/issues/280#issuecomment-1292871889 It brings back the error that the OP mentioned in my case.
Fixed in next-transpile-modules@10.0.0
, cheers!
Side note: app dir is experimental, use with caution!
Anybody else having issues using hooks in transpiled components in Next 13 + next-transpile-modules?
Can you open an issue and / or create a reproduction?
@timneutkens @martpie @here
Any idea on timelines as to when transpilePackages
will become stable.
We want to use it in a production application but are hesitant since it's in the experimental phase as of now.
@karanshah229 In 13.1, can't share a time yet. We're not planning additional changes to it so should be fine to use and switch over the flag once 13.1 is out.
@karanshah229 I would recommend switching now.
Yes it's experimental, but it's only a build step thing, if it does not work for you you will see it before your app is deployed to prod, and you will likely not run into any runtime issue (unless you use it to make package IE11 compatible, a thing you should NOT do).
I have personally tested all recommended setups and they are all working great with transpilePackages
, and I am preparing an official deprecation for soon :)
I believe this doesn't work with Next.js 13 w/ the following config:
I get the following error re Webpack: