-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add es module #7
base: master
Are you sure you want to change the base?
Conversation
index.es.js
Outdated
@@ -0,0 +1,35 @@ | |||
import assert from 'www.unpkg.com/nanoassert?module' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs a protocol?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this?
import assert from 'https://www.unpkg.com/nanoassert?module'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea. actually, doesn't unpkg automatically rewrite import paths when you use ?module
? just doing import assert from 'nanoassert'
might just work already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't .Something like https://unpkg.com/md?module
get resolved to https://unpkg.com/[email protected]/dist/md.es.js?module
which is the actual version plus whatever you defined in your module property in package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean how the import
statements in the package source code get rewritten, like this:
so if we do import assert from 'nanoassert'
here, unpkg would turn it into import assert from 'https://unpkg.com/[email protected]/index.js?module'
automatically. bundlers could also use this entry point then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you mean when already published? Actually never tried that, it would be much cleaner.
@yoshuawuyts @goto-bus-stop Thanks for your comments. |
No description provided.