openpgpjs / openpgpjs/web-stream-tools

include transpiled ES5 code on npm?

Open
#12 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
35
Forks
15
Avg merge
1h 23m
Merged PRs (30d)
1

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the package's build and npm publishing configuration and how the current ES6 output is exposed to consumers. Determine how an ES5 build could be published alongside the existing output, then verify that an ES5-targeting TypeScript consumer can import it without the workaround described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.