Skip to content

add cli exports #1522

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

Closed
wants to merge 1 commit into from
Closed

Conversation

jtenner
Copy link
Contributor

@jtenner jtenner commented Oct 26, 2020



  • I've read the contributing guidelines

Hey! Just thought these might be useful for as-pect. Do you think we should add a few more?

@dcodeIO
Copy link
Member

dcodeIO commented Oct 27, 2020

Did you try what happens when exports is removed? Given that there may be more exports we'd have to add, that seems like a viable alternative for the time being :)

@jtenner
Copy link
Contributor Author

jtenner commented Oct 27, 2020

I don't know? After some testing, I discovered that adding those to the exports works just fine. Are you sure we need to remove "exports" altogether?

@dcodeIO
Copy link
Member

dcodeIO commented Oct 28, 2020

Playing around with this currently, and apparently this already works in node 15:

  "exports": {
    ".": "./index.js",
    "./cli/*": "./cli/*.js",
    "./lib/*": {
      "import": "./lib/*/index.js",
      "require": "./lib/*/umd/index.js"
    }
  },

@dcodeIO
Copy link
Member

dcodeIO commented Oct 28, 2020

Also tried what happens when removing exports now, and that works with require as before it seems, but with import one has to append the .js file extension then.

@dcodeIO
Copy link
Member

dcodeIO commented Oct 28, 2020

Another one: Appending "./*": "./*" as the last exports entry allows using anything within the package by means of requiring/importing its full file name. "./*": "./*.js" allows omitting the file extension, but pins it.

@jtenner
Copy link
Contributor Author

jtenner commented Oct 28, 2020

Hey. Sorry I couldn't swing around to this. I assume we are closing in favor of #1527 ?

@jtenner jtenner closed this Oct 28, 2020
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

Successfully merging this pull request may close these issues.

2 participants