strict

How to use the strict transformer.

The strict transformer automatically places a "use strict"; directive at the top of your files. This enables strict mode which is required as ES2015 modules have an implicit strict mode.

Example

In

foo();

Out

"use strict";

foo();

Blacklisting

There may be scenarios where you don't want this directive placed at the top of your files, you can avoid this behaviour by blacklisting the strict transformer.

PLEASE NOTE: If you do this you're willingly deviating from the spec and this may cause future interop issues.

$ babel --blacklist strict script.js
require("babel").transform("code", { blacklist: ["strict"] });