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 main field in package.json #312

Closed
CircleCode opened this issue Sep 8, 2021 · 3 comments
Closed

missing main field in package.json #312

CircleCode opened this issue Sep 8, 2021 · 3 comments

Comments

@CircleCode
Copy link

CircleCode commented Sep 8, 2021

your package seems to fail resolution with eslint because it lacks a main field in package.json.

For example, on @tinyhttp/content-disposition, package.json should include "main": "./dist/index.js",

without the main field, normal imports do not work:

import { contentDisposition } from "@tinyhttp/content-disposition"; //eslint cannot find the module

but the following works:

import { contentDisposition } from "@tinyhttp/content-disposition/dist";
@CircleCode CircleCode added the bug Something isn't working label Sep 8, 2021
@CircleCode
Copy link
Author

see import-js/eslint-plugin-import#2132 for eslint point of view:

A package just for the browser still needs node behavior, even if that’s “nothing”, so having it lack a main is a bug.

@talentlessguy
Copy link
Member

"main" field is for CommonJS

tinyhttp is ESM-only and uses "exports" instead.

so not planning on returning "main" back, it's an eslint-plugin-import issue not tinyhttp's, sorry :c

@talentlessguy talentlessguy removed the bug Something isn't working label Sep 8, 2021
@CircleCode
Copy link
Author

for future reference (I adhere to your point of view), there are issues on eslint-plugin-import to support exports:

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

No branches or pull requests

2 participants