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

Missing "./package.json" in package.json "exports" #2556

Closed
4 tasks done
artuska opened this issue Nov 4, 2024 · 5 comments
Closed
4 tasks done

Missing "./package.json" in package.json "exports" #2556

artuska opened this issue Nov 4, 2024 · 5 comments
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on

Comments

@artuska
Copy link

artuska commented Nov 4, 2024

Initial checklist

Problem

Missing "./package.json" in package.json "exports":

"exports": {
   ".": "./index.js",
  "./internal-create-format-aware-processors": "./lib/util/create-format-aware-processors.js",
  "./internal-extnames-to-regex": "./lib/util/extnames-to-regex.js"
},

Solution

Just add "./package.json" in package.json "exports" like that:

"exports": {
  "./package.json": "./package.json",
   ".": "./index.js",
  "./internal-create-format-aware-processors": "./lib/util/create-format-aware-processors.js",
  "./internal-extnames-to-regex": "./lib/util/extnames-to-regex.js"
},

Alternatives

Just add "./package.json" in package.json "exports".

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Nov 4, 2024
@ChristianMurphy
Copy link
Member

Welcome @artuska! 👋
I'm open to adding the package to the exports.
Could you expand a bit on what you want out of that file? And why or how you want to leverage it?

@artuska
Copy link
Author

artuska commented Nov 4, 2024

This feature is related to the Vite issue — originjs/vite-plugin-federation#357

@ChristianMurphy
Copy link
Member

@artuska it looks like a bug in an abandoned module originjs/vite-plugin-federation#597
And that it is no longer recommended originjs/vite-plugin-federation#597 (comment)

Try migrating to https://github.com/module-federation/vite

I'd hold on making changes here because:

  1. it's not clear why the package is needed by the tool in the first place
  2. it's an abandoned tool, and I don't think it's a good idea to try to change the entire npm ecosystem to try to fix abandoned tools

@wooorm
Copy link
Member

wooorm commented Nov 5, 2024

Paraphrasing the argument here, some unmaintained, uncommon, tool is broken and an error can disappear when we add package.json to exports. There are viable alternatives: migrating to a maintained alternative or patch-package. I don’t think that’s a good story for changing things here.

For me, it is intentional that package.jsons are not part of the public API. We can have a discussion about adding them to all packages. We could test a small subset of course and it doesn’t have to be all at once. But still: I’m not convinced yet and that would be a whole discussion about trade offs, so more something for https://github.com/unifiedjs/rfcs or so.

That discussion would have little to do with the arguments here. So, closing this issue for now.

@wooorm wooorm closed this as not planned Won't fix, can't repro, duplicate, stale Nov 5, 2024
@wooorm wooorm added the 👀 no/external This makes more sense somewhere else label Nov 5, 2024

This comment has been minimized.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

3 participants