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

Expose individual files as exported files #81

Closed
jcbhmr opened this issue Jul 16, 2023 · 1 comment · Fixed by #87
Closed

Expose individual files as exported files #81

jcbhmr opened this issue Jul 16, 2023 · 1 comment · Fixed by #87
Labels
enhancement New feature or request question Further information is requested

Comments

@jcbhmr
Copy link
Collaborator

jcbhmr commented Jul 16, 2023

Basically add this to package.json

{
  "exports": {
    ".": "./dist/index.js",
    // In addition to ☝
    "./*.js": "./dist/*.js"
  }
}

to allow:

import { isObject } from "is-what/isObject.js"

or if we used default exports

import isObject from "is-what/isObject.js"

this is in the spirit of keeping the package as light as possible. This way, even if your target environment doesn't do bundling/tree-shaking, you can still manually "treeshake" in your code to only import what's needed.

cc @mesqueeb is this a good idea?

@jcbhmr jcbhmr assigned jcbhmr and unassigned jcbhmr Jul 16, 2023
@jcbhmr jcbhmr added enhancement New feature or request question Further information is requested labels Jul 16, 2023
@jcbhmr
Copy link
Collaborator Author

jcbhmr commented Jul 17, 2023

This is actually one of the reasons I wanted #57 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant