Hacker News new | ask | show | jobs
by spicyj 3689 days ago
babel-preset-es2015 is as canonical a "default configuration" as you're likely to find.
1 comments

Does it enforce you putting `.js` on import strings? It should.
Why would it.. babel doesn't do any actual import/export modification. It doesn't have a module/bundler built in... that's what webpack, browserify and the like are for.. and no, they don't require the .js, but you can still use it.
Right, but the argument for being spec compliant is that some day you can simply stop using the transpiler and your code should not break.

So, the correct spec-compliant thing to do would be for the ES2015 preset not to touch import/export and let the bundler handle that (hopefully correct). Compiling to CommonJS, which doesn't care about `.js` or not, is the wrong choice.