Replies: 1 comment
-
|
Okay. I figured out the issue. In hindsight it was obvious but I missed that node decides on esm or cjs context per module and not per program instance. This means that if an cjs module is imported from an esm module the cjs module will be executed within cjs context, meaning Tracing those dependencies works but it would be really cool if rolldown could keep the ems/cjs boundaries while bundling for the server side but this is an whole other topic. |
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.
-
Hi,
I have a project that is currently using nitro
v3.0.1-alpha.1withvite-rolldown. That project is using a google-cloud lib that is commonjs and at some point relies at__dirname. Everything is working as expected but I have issues upgrading to the newer nitro versionv3.0.1-alpha.2with the vite 8 beta as it states that__dirnameis not present in an esm context which actually makes sense.As far is I understood nitro did always compile to esm so I guess there was a fix in place that handled that
__dirnameusage? Additionally this is only a problem in the production build, in development everything is working as expected.Can someone provide guidance on how to resolve that issue? I guess I could just globally set
__dirnameto a static value but this seems like an sub-optimal solution.Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions