Next 15 compatibility and temporary option to force page router
Bump swc_core to 0.106.* to be in line with [email protected].
next changed the filename metadate making this plugin unable to detect app or page router https://github.com/vercel/next.js/issues/72019.
Added a temporary option to force page router, this will make the plugin incompatible with projects using both routers.
Any updates on this?
It seems like a breaking change from upstream.
If that change is intended, we may need to drop router detection feature and should provide an option for the users to select the router type in own hands.
@orionmiz @serg-and a plugin option to manually set the router type would indeed be the most expedient solution
I use both routers in production in several apps, and just want to add that I'd be perfectly happy with manually choosing which router I want this plugin to apply to ππΌ
I forked and published this plugin with compatibility for Next.js@15, since this plugins to no longer be maintained.
https://github.com/serg-and/superjson-next https://www.npmjs.com/package/superjson-next
We were digging into this topic a bit deeper and noticed that for react server components (i.e. app router only) there is a much simpler solution without the need for a SWC plugin.
We've published our results as a new open source project called rsc-superjson.
The library provides a simple react hoc that achieves the same result as this SWC plugin but in a more explicit wayβwithout requiring an SWC plugin.
As a bonus, switching from the SWC plugin to rsc-superjson reduced our build times by approximately 3.5%.
Additionally rsc-superjson also brings support for the return values of server actions
Ah, we're still on the pages router so won't be useful for us. But seems like a nice solution.
I forked and published this plugin with compatibility for Next.js@15, since this plugins to no longer be maintained.
https://github.com/serg-and/superjson-next https://www.npmjs.com/package/superjson-next
@orionmiz @siddhsuresh it would be better for the Next / Blitz community if this wasn't necessary, but I understand why it happened RE: how much time has passed π
Enough time for an upstream fix has passed, but the issue still exists. I'll create an plugin option to manually select one router type and create a compatibility table that specifies which plugin versions are available based on the version of Next.js. (This option can be removed by a future upstream bug fix.)
And creating a bundler plugin(webpack, turbopack) also can be considered for the future due to the lack of context provided to compiler plugins. (related issue #90)
@orionmiz your response was a relief to see but, with respect, another month has passed
@orionmiz @siddhsuresh ππ»
-
237 days since this community PR was opened to add a "force page router" option
-
81 days since maintainer pledged to add option themselves (which is presumably not difficult, just something they're particular about)
If this package is abandoned and users would be best switching to an alternative solution, please update the project README and place a deprecated notice on NPM
πͺ¦ π π¦
At this point, definitely just use the superjson-next fork offered by @serg-and π
- ~237~ 269 days since this community PR was opened to add a "force page router" option
- ~81~ 113 days since maintainer pledged to add option themselves (which is presumably not difficult, just something they're particular about)
the Next.js team has finally fixed the issue, so we can enable auto router type detection again. pushed a new release of the fork because this repo seems hella dead.