Skip to content

include transpiled ES5 code on npm? #12

@tomholub

Description

@tomholub

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions