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
ERR_MODULE_NOT_FOUND when inlining some modules #2308
Comments
here's the ouput with mlly 1.4.0 import * as ApplicationInsights from 'file://G:/repo/nitro/node_modules/.pnpm/[email protected]/node_modules/applicationinsights/out/applicationinsights.js';
import ApplicationInsights__default, { DistributedTracingModes } from 'file://G:/repo/nitro/node_modules/.pnpm/[email protected]/node_modules/applicationinsights/out/applicationinsights.js'; seems like |
We probably cannot safely enable stripping comments for mlly until next major version that uses AST-aware stripping. I know it is a pain for some legacy modules but making changes to CJS/ESM detection that can fixes one legacy module can break other legacy modules. I am closing this issue because the only common reported case is applicationinsights but if there are more common legacy packages that having issues, i would be happy to see what we can do for Nitro v2 fix. Made a tracker issue in huang-julien/nitro-applicationinsights#59 for an alternative suggestion. |
Environment
Reproduction
https://stackblitz.com/edit/unjs-nitro-starter-mhus1e?file=module%2Fmod.ts,module%2Fruntime%2Fplugin.ts,nitro.config.ts&title=Nitro%20Starter
Describe the bug
There's currently an issue (again sorry 🙏) with applicationinsights node.
We have a different issue on stackblitz and windows.
On windows we have
while on stackblitz the module is not found.
The only way to fix it seems to be to force the resolution of mlly to 1.4.0.
I think it's probably due the strip comment feature for mlly
hasEsmSyntax
andhasCjsSyntax
is behind an experimental feature flag not enabled by default.Additional context
The issue with windows is that the absolute paths generated in
.nitro/dev/index.mjs
are generated withoutfile://
for applicationinsights imports.After manually adding them back
We have another issue which is the stackblitz one.
Logs
No response
The text was updated successfully, but these errors were encountered: