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

refactor: import defineNitroPlugin from #imports instead of nitropack/runtime #2787

Merged
merged 3 commits into from
Sep 27, 2024

Conversation

ejfox
Copy link
Contributor

@ejfox ejfox commented Sep 18, 2024

This is my first PR- but this bug has been bugging me for a few weeks now, and I'm not sure if I have some unique setup that causes the error, but this is blocking me from doing pretty much anything- so I figured I'd give it a shot!

I am not sure the best way to go about testing this- but I am essentially cargo-culting the solution from nuxt/icon and hoping this can be solved in the same way- let me know how to best support/test/finish this off and I will do my best

🔗 Linked issue

MIGHT SOLVE #2736

Related:

❓ Type of change

I tried the mirror the changes from nuxt/icon in this commit: https://github.com/nuxt/icon/pull/249/files

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

In the previous version, defineNitroPlugin was imported from nitropack/runtime - this instead uses #imports

Currently when running yarn dev with latest Nuxt / Nuxt Content, I get this:

[10:37:10 AM]  ERROR  [worker reload] [worker init] Package import specifier "#internal/nitro/virtual/plugins" is not defined in package /Users/ejfox/code/website/node_modules/nitropack/package.json imported from /Users/ejfox/code/website/node_modules/nitropack/dist/runtime/app.mjs

  at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
  at new NodeError (node:internal/errors:405:5)
  at importNotDefined (node:internal/modules/esm/resolve:348:10)
  at packageImportsResolve (node:internal/modules/esm/resolve:775:9)
  at moduleResolve (node:internal/modules/esm/resolve:930:16)
  at defaultResolve (node:internal/modules/esm/resolve:1129:11)
  at nextResolve (node:internal/modules/esm/loader:163:28)
  at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
  at link (node:internal/modules/esm/module_job:76:36)

which prevents both publishing and development

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link
Member

@farnabaz farnabaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@farnabaz farnabaz merged commit 34f6517 into nuxt:main Sep 27, 2024
2 checks passed
@itpropro
Copy link
Contributor

itpropro commented Oct 4, 2024

Hey @farnabaz any plans on creating a hotfix release for this?

@BayBreezy
Copy link

Kindly asking if this will be released any time soon? I cant deploy most of the apps that use this module because of this error.

Copy link
Member

farnabaz commented Oct 8, 2024

Hey there,
This week I will prepare a patch release

@BayBreezy
Copy link

Thanks. Appreciate it

@mlkt
Copy link

mlkt commented Oct 13, 2024

What is the root cause? In my case, I can't avoid it with #imports

import { useRequestBody } from "nitropack/runtime/utils";

It's not work:

import { useRequestBody } from "#imports";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants