There are two file processing modes in the ES6 specification:
Like a βscript,β which will usually be all that we're used to in the standard JS environment
The syntax of the ES6 module is not allowed, and for backward compatibility reasons, content is only considered strict if it has the "use strict"; directive "use strict"; .
Like a "module"
The syntax of the ES6 module is allowed, and in all cases all the code is strict.
Since the syntax of the ES6 module is related to whether something is a module or a script, and if something is a βmoduleβ, it is automatically strict, Babel uses transform-es2015-modules-commonjs to include both transformations in the same time.
Even if you have to enable only the module conversion itself and exclude strict mode, all the code you wrote is technically invalid, and as soon as you try to use your ES6 code in the real environment of the ES6 module, it would be strict whether you like it or not.
If you do not want your code to be strict, I would suggest disabling the transform-es2015-modules-commonjs and using CommonJS modules, since they do not have such a strict mode requirement.
source share