This plugin places a 'use strict'; directive at the top of all files to enable strict mode
> This plugin places a "use strict"; directive at the top of all files to enable strict mode.
This plugin may be enabled via babel-plugin-transform-es2015-modules-commonjs.
If you wish to disable it you can either turn strict off or passstrictMode: false as an option to the commonjs transform.
In
``javascript`
foo();
Out
`javascript
"use strict";
foo();
`
`sh`
npm install --save-dev babel-plugin-transform-strict-mode
.babelrc
Without options:
`json`
{
"plugins": ["transform-strict-mode"]
}
With options:
`json`
{
"plugins": [
["transform-strict-mode", {
"strict": true
}]
]
}
`sh`
babel --plugins transform-strict-mode script.js
`javascript``
require("babel-core").transform("code", {
plugins: ["transform-strict-mode"]
});