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

Invalid package.json field for sub packages #4536

Closed
BreakBB opened this issue Apr 26, 2023 · 7 comments
Closed

Invalid package.json field for sub packages #4536

BreakBB opened this issue Apr 26, 2023 · 7 comments

Comments

@BreakBB
Copy link

BreakBB commented Apr 26, 2023

Description

The package.json in released sub packages such as is-debug reference a "bundle.js" in their main field which is only valid for the core module.

That results in an issue for newly created vite projects:

import {IsDebug} from '@awesome-cordova-plugins/is-debug';

Error: Failed to resolve entry for package "@awesome-cordova-plugins/is-debug". The package may have incorrect main/module/exports specified in its package.json.

Proposal

The publish.ts should become aware of the modules it is building the package.json for and drop the main field for everything except the core module.

@Tallyb
Copy link

Tallyb commented Jun 22, 2023

This is critical! it makes the packages unusable with variety of tools

@daohoangson
Copy link

daohoangson commented Aug 20, 2023

Apparently this was introduced 2 years ago via #3483:

  • generateLegacyBundles was added to rollup CJS from core/index.js and plugins/**/ngx/index.js.
  • The core index file is in root so its bundle.js is put there
  • The plugin's one is in ngx directory so the generated file is in the subdirectory
  • The main field in PACKAGE_JSON_BASE doesn't take this into account so it always references the root file and triggers warning in different tools.

There are 2 approaches to fix for this IMHO:

  1. Update generateLegacyBundles to target plugin root index.js file instead of the Angular one.
  2. Or adjust main field for plugins

I think the first approach is more correct. Paging @laurentgoudet, what do you think?

@coltanium13
Copy link

We have noticed this same issue in our vite project, with the web-intent sub package as well. If you remove the main property from the web-intent's package.json file, it seems to work ok. Can we get a fix to these sub packages? Thank you!

@BreakBB
Copy link
Author

BreakBB commented Oct 18, 2023

Any news on this @danielsogl ?

Copy link

There has been no recent activity and this issue has been marked inactive.

@BreakBB
Copy link
Author

BreakBB commented Dec 18, 2023

The repo doesn't seem to be abandoned, still there is no reply from a maintainer?

Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants