What Does The "modules:auto" Means In @babel/preset-env Field?
the babel docs say the modules default option is auto, what does the auto means? does it transform the 'import' to 'require' or not? what's the difference between 'modules: false'
Solution 1:
It seems that the documentation for auto is described in this pull request. According to that PR:
The default
autowill automatically selectfalseif ES6 module syntax is already supported by the caller, or"commonjs"otherwise.
So, if ES6 is supported (which seems to be your case) setting modules to auto its the same as setting false.
Solution 2:
auto means default value and default value of modules is false. See - https://github.com/babel/babel/pull/8485/files#r236086742.
Solution 3:
it enable transformation of ES6 module syntax to another module type.
Reference : https://babeljs.io/docs/en/babel-preset-env#modules

Post a Comment for "What Does The "modules:auto" Means In @babel/preset-env Field?"