DEV Community

Discussion on: Bringing Modern JavaScript to Libraries

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

tl, but if I expect loyalty from users, wouldn't it be better to use something near esnext, and notify users to use latest browsers, if some features are not supported?

Especially the case with web apps.

However, for static websites (probably with API's), I believe it should be able to run even with JavaScript disabled. (Still, CSS supports can still be an issue, not sure about HTML5.)

Also, can anyone please conclude, what the preferred settings for Babel / tsc / browserify / Snowpack? (I have used Rollup, but I feel it can be unreliable.)

Alternative Solution: Multiple Entry Points by Year

Another thought -- (pre-)building on the CDN based on User Agents?

Collapse
 
_developit profile image
Jason Miller 🦊⚛

User Agents are an increasingly unreliable mechanism for determining the compile target. Also, esnext does not mean the latest browsers, it means the latest spec version. The current versions of Safari and Firefox are missing support for some ES2019 features, let alone Firefox ESR or Safari for iOS. An esnext target is not connected to any real-world usage, it's purely a theoretical syntax level based on in-flight specification work. Ultimately, the browser implementors decide which JavaScript features ship and which don't.