Skip to content
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

Does not include registered ESM loader hooks #428

Closed
timfish opened this issue Jun 25, 2024 · 3 comments · Fixed by #429 · May be fixed by leonardoadame/Affiliate-tech#862 or Thompson1985/vercel#5
Closed

Does not include registered ESM loader hooks #428

timfish opened this issue Jun 25, 2024 · 3 comments · Fixed by #429 · May be fixed by leonardoadame/Affiliate-tech#862 or Thompson1985/vercel#5
Labels
bug Something isn't working good first issue Good for newcomers released

Comments

@timfish
Copy link
Contributor

timfish commented Jun 25, 2024

package.json

{
  "type": "module",
  "dependencies": {
    "import-in-the-middle": "^1.8.1"
  },
  "devDependencies": {
    "@vercel/nft": "^0.27.2"
  }
}

test.js

import { register } from 'module';

register('import-in-the-middle/hook.mjs', import.meta.url);

build.js

import { nodeFileTrace } from '@vercel/nft';
const { fileList } = await nodeFileTrace(['./test.js']);
console.log(fileList)

Running > node build.js
Outputs Set(1) { 'test.js' }

But import-in-the-middle/hook.mjs and all of it's dependencies should be included.

@timfish timfish changed the title Does not detect registered ESM loader hooks Does not include registered ESM loader hooks Jun 25, 2024
@styfle styfle added bug Something isn't working good first issue Good for newcomers labels Jun 26, 2024
@s1gr1d
Copy link

s1gr1d commented Sep 2, 2024

This also affects nitropack (and therefore also Nuxt). The .output build folder of nuxt does not include import-in-the-middle/hook.mjs which can lead to the same error.

I am not a 100% sure how nuxt builds nuxt apps under the hood but nodeFileTrace is used here in nitropack: https://github.com/unjs/nitro/blob/v2/src/rollup/plugins/externals.ts

@pi0 @vercel/nft should probably be updated after this is merged: #429

@pi0
Copy link

pi0 commented Sep 2, 2024

Thanks for the heads up @s1gr1d. Nitro has a caret ^ dependency on @vercel/nft which means as long as any fix or enhancement lands in a semver-minor/patch version of this package, updating your lock file is enough to get the fix.

Nevertheless feel free to report an issue downstream in nitropack repo if you can assemble a minimal nitro reproduction 🙏🏼

@kodiakhq kodiakhq bot closed this as completed in #429 Sep 3, 2024
@kodiakhq kodiakhq bot closed this as completed in 37b3c16 Sep 3, 2024
Copy link

github-actions bot commented Sep 3, 2024

🎉 This issue has been resolved in version 0.27.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers released
Projects
None yet
4 participants