question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] Set target to ES5

See original GitHub issue

Have you considered changing the build target to ES5 instead of ES6 so that this library works across more browsers?

Alternatively, you can ship 2 different builds (one with target=ES5 and one with target=ES6), I’ve seen some other libraries do this and then as a client, I could do import useLocalStorageState from "use-local-storage-state/es5".

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
astoilkovcommented, Feb 3, 2021

@callumlocke @Luccasoli This issue is not related to the ES5 target. I created a new issue for that – #20. I fixed the issue in a new 8.0.0 release. You can upgrade now but you should do it manually because the ^7.0.0 constraint doesn’t allow it.

1reaction
astoilkovcommented, Feb 25, 2021

I thought a lot about this. I decided to not add support for ES5. These are my arguments:

  • ES5 is an edge case. I don’t know how much but I believe there is a very small amount of users that need this. IE takes 0.8 percent of the market share.
  • It’s not a deal-breaker. Users can still use @babel to transpile this module to ES5. This solution will be increasingly more popular as more modules don’t support ES5.
  • The trend I am trying to follow is forward not backward. I am currently shipping two versions of the package: non-ESM and ESM and it’s overly complicated. I will be soon shipping only ESM(same as Sindre Sorhus). This will probably get even more users mad but this will push the ecosystem further.
  • It adds complexity to the codebase. I am obsessed with code complexity and this will add an additional step to the build process and complicate it. I don’t like that.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Proposal: set target to es6 by default for tsserver · Issue #6398
Hello, For now, you have to specify the target in tsconfig.json when you want to use es6 features in tsserver It would be...
Read more >
babel/preset-env
babel/preset-env` is a smart preset that allows you to use the latest JavaScript without needing to micromanage which syntax transforms (and optionally, ...
Read more >
tsconfig target set to es5 but still uses let & const
I am trying to use UglifyJS on code generated by tsc. The target is set to es5 but the generated code still uses...
Read more >
Documentation - Decorators - TypeScript
With the introduction of Classes in TypeScript and ES6, there now exist certain scenarios that require additional features to support annotating or ...
Read more >
Content Types - ESBuild
This loader is enabled by default for .js , .cjs , and .mjs files. The .cjs extension is used by node for CommonJS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found