Hacker News new | ask | show | jobs
by hzoo 3089 days ago
> From what I understood, there is currently nothing to allow both ES5 and ES6 code to be published and let the bundler choose which one to include. Any ideas on how to change this?

Yeah it's mostly a conventional then we have to figure out.

Some people have different "dist" folders like say with redux_- https://unpkg.com/redux@3.7.2/ there is `src`, `lib`, `es`, `dist`.

In package.json, you can specify

  "main": "lib/index.js",
  "module": "es/index.js",
  "jsnext:main": "es/index.js",
  "typings": "./index.d.ts",
which a bundler like webpack will look at. The problem now mostly is that "module" assumes es modules but not a specific level of ES/polyfills and we want a way to do that instead. Making a yearly "es2015", "es2016" field seems weird and we want one that is up to date like preset-env?