-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
no-unresolved
is not aware of exports
definition in package.json
#1810
Comments
Indeed, that’s where it needs to be fixed. However, for back compat, you should have a file at the location the exports key would otherwise resolve to anyways - so even when it’s fixed in resolve, you’d still want it fixed now. |
import/no-unresolved
raise false positive when there is no main
field in the package.json
#2132
Will this be resolved any time soon? We're going to have to yank |
@inlined why would your Google SDKs be using |
We are using For example, |
Right - but that's not backwards-compatible to pre-exports node. However, if you created an actual |
We control our execution environment and do not need to be backwards compatible to versions that don't support exports (every supported LTS of Node supports exports). Also, putting a root export would muddy project structure. It is quite common to have a |
The import module does not currenty handle package exports. The author is apparently of the opinion that exports should not use renaming features. Until this is fixed, all of the v2 API is broken. See import-js/eslint-plugin-import#1810 for more info.
The import module does not currenty handle package exports. The author is apparently of the opinion that exports should not use renaming features. Until this is fixed, all of the v2 API is broken. See import-js/eslint-plugin-import#1810 for more info.
@inlined i'm not "of the opinion that exports should not use renaming features", i'm of the opinion that you have a really simple workaround while you wait. None of my "opinions" are delaying |
@inlined if google wants to help make it happen faster, please feel free to visit https://github.com/browserify/resolve?sponsor=1 |
* Print function names on validation errors, not [Object object] * Require all necessary APIs * Remove import eslint module The import module does not currenty handle package exports. The author is apparently of the opinion that exports should not use renaming features. Until this is fixed, all of the v2 API is broken. See import-js/eslint-plugin-import#1810 for more info. * Linter fixes
For what it's worth, here's how I solved this situation for a package of mine. The import style of the library is: import { fn } from "mylib/next";
import { fn } from "mylib/express"; I updated my package.json build steps with: {
"prepublishOnly": "npm run build && cp next/dist/* next/ && cp express/dist/* express/",
"postpublish": "rm next/*.d.ts next/*.js next/*.map next/*.mjs && rm express/*.d.ts express/*.js express/*.map express/*.mjs"
} What this does is make copies of the build output files right before npm publish and remove them right after. A bit hacky but it definitely works and will ensure the package works well even on bundlers not supporting the exports: {} field of package.json. Thanks to the maintainers of eslint-plugin-import for the very hard work they do. |
@vvo you can also |
Indeed, but I don't want to see these files in my editor (VSCode), they would still appear as grayed out I guess. But I will still add them to gitignore so they never get |
@vvo gitignore is so they don't get committed; you DO want them published, which means you have to have a |
Thanks updated my comment to add committed. Also, I am using the "files: ["dist", "express", "next"]" setting of npm. |
* Print function names on validation errors, not [Object object] * Require all necessary APIs * Remove import eslint module The import module does not currenty handle package exports. The author is apparently of the opinion that exports should not use renaming features. Until this is fixed, all of the v2 API is broken. See import-js/eslint-plugin-import#1810 for more info. * Linter fixes
Hi all, FYI I am successfully using this tiny ESLint import resolver to support ESM modules imports via package.json exports map: https://gist.github.com/danielweck/cd63af8e9a8b3492abacc312af9f28fd Duplicate issue? #1868 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
It’s just me, and what’s acceptable is only up to collaborators. I’m going to lock the thread for a bit. Additionally, hiding comments isn’t silencing anything - that’d be called “deleting comments”. I’m just making them hidden by default so they don’t distract new readers of the issue. |
From this announcement
Might need to be fix in
resolve
package..The text was updated successfully, but these errors were encountered: