You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: This issue may not be resolved with additional build targets. The goal is to document and consider the options.
Summary
Webnative builds currently targets es2020. We would like to support a wider range of targets, as old as possible.
Problem
Webnative will not work in some browsers that lack full es2020 support. Mostly, this means Internet Explorer and less used mobile browsers, though notably export * as namespace is not available in Safari on iOS or Android Browser. See es2020 features summary.
In addition to browsers, some bundlers and build tools may not support es2020 and may require users to target some other environment. Notably, SvelteKit only supports es2019 builds.
Impact
Webnative will not work in some older browsers, mostly notably Internet Explorer. We have not encountered build environment issues in Safari for iOS or Android Brower. (Please add a comment below if you have noticed otherwise!)
Webnative will not build in SvelteKit due to the lack of support for big integer literals. SvelteKit does not currently offer a way to configure the Vite build target, which is set at es2019. See sveltejs/kit#859 (comment) for a summary.
There may be additional bundlers and build environments with similar restrictions. (Please add them below 🙏)
Solution
We have explored a couple of solutions. None stands out yet as the right way to go. See the details below.
Detail
Is your feature request related to a problem? Please describe.
Webnative does not build in SvelteKit.
Describe the solution you'd like
Unclear. No solution stands out as the best option yet.
Describe alternatives you've considered
Transpile or polyfill to older targets. Unfortunately, this does not seem like a viable solution. Webnative uses noble-ed25519 which uses big integer literals. The general consensus is that big integer literals are "impossible to polyfill and infeasible to transpile because the performance would be terrible".
Google wrote the JSBI with this in mind. In their README:
To use BigInts in code that you want to run everywhere, you need a library. But there’s a difficulty: the BigInt proposal changes the behavior of operators (like +, >=, etc.) to work on BigInts. These changes are impossible to polyfill directly; and they are also making it infeasible (in most cases) to transpile BigInt code to fallback code using Babel or similar tools. The reason is that such a transpilation would have to replace every single operator in the program with a call to some function that performs type checks on its inputs, which would incur an unacceptable performance penalty.
Find replacement libraries. We may be able to find alternative implementations that do not rely on big integer literals or other features that cannot be transpiled.
Open questions:
Do other libraries use big integer literals or other es2020-only features?
Does webnative use any of these features directly?
One related is alternative is asking library authors about alternatives that use JSBI or similar alternatives that provide compatibility with older build targets. This request may be declined because, in some cases, it would essentially mean a re-write.
Do nothing. Wait for the ecosystem to catch up. This would mean that webnative would not be available in some environments for a time.
Something else? Please suggest other alternatives below. This is all based on initial research that should not be considered exhaustive or complete.
The text was updated successfully, but these errors were encountered:
Initial tests in #277 indicate that we may be able to replace noble-ed25519 with tweetnacl. In addition, these tests have confirmed for us that noble-ed25519 is the only library we are currently using with big integer literals.
Some of the initial motivation for supporting older build targets has dissipated. SvelteKit now permits es2020 as a build target: sveltejs/kit#2220.
We should still consider the change in #277 for a few reasons:
It would add support for Create React App
There may be other bundlers/build systems that we have not considered that would benefit
tweetnacl has been audited and has been in use for many years
Note: This issue may not be resolved with additional build targets. The goal is to document and consider the options.
Summary
Webnative builds currently targets
es2020
. We would like to support a wider range of targets, as old as possible.Problem
Webnative will not work in some browsers that lack full
es2020
support. Mostly, this means Internet Explorer and less used mobile browsers, though notablyexport * as namespace
is not available in Safari on iOS or Android Browser. See es2020 features summary.In addition to browsers, some bundlers and build tools may not support
es2020
and may require users to target some other environment. Notably, SvelteKit only supportses2019
builds.Impact
Webnative will not work in some older browsers, mostly notably Internet Explorer. We have not encountered build environment issues in Safari for iOS or Android Brower. (Please add a comment below if you have noticed otherwise!)
Webnative will not build in SvelteKit due to the lack of support for big integer literals. SvelteKit does not currently offer a way to configure the Vite build target, which is set at
es2019
. See sveltejs/kit#859 (comment) for a summary.There may be additional bundlers and build environments with similar restrictions. (Please add them below 🙏)
Solution
We have explored a couple of solutions. None stands out yet as the right way to go. See the details below.
Detail
Is your feature request related to a problem? Please describe.
Webnative does not build in SvelteKit.
Describe the solution you'd like
Unclear. No solution stands out as the best option yet.
Describe alternatives you've considered
Transpile or polyfill to older targets. Unfortunately, this does not seem like a viable solution. Webnative uses noble-ed25519 which uses big integer literals. The general consensus is that big integer literals are "impossible to polyfill and infeasible to transpile because the performance would be terrible".
Google wrote the JSBI with this in mind. In their README:
Esbuild cites this as their reason for not transforming big integer literals: evanw/esbuild#732 (comment)
Find replacement libraries. We may be able to find alternative implementations that do not rely on big integer literals or other features that cannot be transpiled.
Open questions:
Do other libraries use big integer literals or other
es2020
-only features?Does webnative use any of these features directly?
One related is alternative is asking library authors about alternatives that use JSBI or similar alternatives that provide compatibility with older build targets. This request may be declined because, in some cases, it would essentially mean a re-write.
Do nothing. Wait for the ecosystem to catch up. This would mean that webnative would not be available in some environments for a time.
Something else? Please suggest other alternatives below. This is all based on initial research that should not be considered exhaustive or complete.
The text was updated successfully, but these errors were encountered: