website icon indicating copy to clipboard operation
website copied to clipboard

preset-env: update `modules` default value

Open Hypnosphi opened this issue 5 years ago • 7 comments

See https://github.com/babel/babel/pull/8485

Hypnosphi avatar Sep 10 '18 19:09 Hypnosphi

Deploy preview for babel ready!

Built with commit 43265b24d3c7dad358a1de8ce75fa1ed4c476a4a

https://deploy-preview-1820--babel.netlify.com

babel-bot avatar Sep 10 '18 19:09 babel-bot

Thanks for the PR!

What are your thoughts on leaving the default value as-is, and instead, add a section atop it that describes how babel-loader@8 uses the caller option to set it to false automatically?

existentialism avatar Sep 10 '18 21:09 existentialism

It's just not true that default value is commonjs. modules: 'commonjs' and absense of modules option have different effects (the former won't be overridden by babel-loader)

Hypnosphi avatar Sep 10 '18 23:09 Hypnosphi

🤷‍♂️ I'm open to what the rest of the team thinks. Ultimately, I agree that the introduction of the caller option makes the notion of "default" a little less clear.

I just think it's important to show both what the behavior is when using the preset directly and what can happen via the caller option... since it's not just babel-loader@8 that can use it.

existentialism avatar Sep 11 '18 02:09 existentialism

Maybe we can split the

defaults to `"commonjs"`.

into a new section that explains it explicitly?

loganfsmyth avatar Sep 11 '18 02:09 loganfsmyth

Yeah, my initial thought was to just call out the fact that it can be different based on caller, and use babel-loader as an example, but I'm fine with replacing the defaults to bit completely.

existentialism avatar Sep 11 '18 03:09 existentialism

“Allow edits from maintainers” is on, so please feel free to reword it

Hypnosphi avatar Sep 11 '18 16:09 Hypnosphi