-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat!: esm only build #772
Open
AuHau
wants to merge
7
commits into
master
Choose a base branch
from
esm
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuHau
force-pushed
the
esm
branch
3 times, most recently
from
October 3, 2022 11:10
bff8e82
to
6a2a06f
Compare
Cafe137
reviewed
Oct 7, 2022
Cafe137
reviewed
Oct 7, 2022
Cafe137
reviewed
Oct 7, 2022
Cafe137
approved these changes
Oct 13, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements ESM-only support, this on its own is breaking change, but together with it it brings several other changes:
await import('https://unpkg.com/@ethersphere/bee-js/dist/index.browser.js')
Data
interface used to be extendedUint8Array
now in order to getUint8Array
you need to useData.bytes()
functionGreat write-up about possible issues, how-to guides, motivation etc. done by
Sindre Sorhus: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
One issue of migrating to ESM is about imports, which now has to have the full file name including the suffix. A bit non-intuitive thing is that even though we work in the TypeScript realm, the import must have
.js
suffix. TypeScript can work with it, but unfortunately does not provide a way to transpile.ts
suffix to.js
or add it based on configuration. There are three ways how to solve this:import
s with.js
suffix (we should figure out ESLint rule for that)ts-node
then using--experimental-specifier-resolution=node
Node flag, lifts this requirement, although it is good to be cautious about this as this is marked as an experimental flagbabel-plugin-add-import-extension
on top of TypeScript transpiled sources. For example see here