-
Notifications
You must be signed in to change notification settings - Fork 15
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
include transpiled ES5 code on npm? #12
Comments
Hey 👋 Yeah, I agree this is something we should do. The main difficulty is around the way we load the streams polyfill "on demand" (i.e. only when it's not natively supported by the browser): web-stream-tools/lib/streams.js Lines 15 to 18 in 8663e15
|
Thanks for the consideration. It may be cleaner to offer several builds, like It's the first time I see this kind of import. That's not understandable by the browser anyway, is it? Rather, meant for the build tool? But if it's for the build tool, then that's long before it sees any browser, so that wouldn't be on-demand. I'm thoroughly confused :-) |
Yeah, we could do that indeed. |
When building/running our TypeScript project which is transpiles into ES5, the TypeScript compiler expects all dependencies to already be also ES5 compatible. And so it trips on
import
statements etc in this library.Disclaimer - I don't know much about npm packaging.
Would it be possible to include ES5 build in the npm package? Ideally in a way where you can continue using ES6 for your toolchain that expects ES6, but others could import ES5 when required.
I did resolve our immediate issue by adding a build step that first transpiles the library from
node_modules/@openpgp/web-stream-tools
ES6 down to an ES5 file that it puts in a local directory, and then our code imports and uses that.I don't know what the contentions are - I've never had to transpile a library to use it before, so I suppose it's common to include transpiled code. Would that be something that you could consider?
The text was updated successfully, but these errors were encountered: