"Virtual" modules in the compiler (Webpack + SWC, or TurboPack... once it has plugins) #71714
TomStrepsil
started this conversation in
Ideas
Replies: 1 comment
-
N.B. Thanks to @larixer of @sysgears who has pointed out this shortcoming has been perhaps introduced by the optimisation introduced in #31685 via #31682. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
As per #44266, some webpack plugins utilise webpack-virtual-modules to provide plugin-generated code, perhaps proxying or transforming source files.
With the SWC compiler enabled, NextJs does not seem to support the idea. Despite the virtual modules setup appearing to work, the compiler will ultimately complain:
With SWC disabled (via using a
.babelrc
), the virtual modules appear to be available.It may be that the suggestion is best raised with SWC, but wondered if a plugin would be best owned by a webpack use-case?
N.B. Vite supports this concept natively: https://vite.dev/guide/api-plugin#importing-a-virtual-file
Proposal
Discovery or creation of a suitable SWC plugin, configured by NextJs to honour the WebPack
InputFileSystem
fully, even if virtualised.Beta Was this translation helpful? Give feedback.
All reactions