How to remove global “use strict” added by babel

As it has already been mentioned for Babel 6, it’s the transform-es2015-modules-commonjs preset which adds strict mode. In case you want to use the whole es2015 preset without module transformations, put this in your .babelrc file: { “presets”: [ [“es2015”, { “modules”: false }] ] } This will disable modules and strict mode, while keeping … Read more

How do you find out the caller function in JavaScript when use strict is enabled?

For what it’s worth, I agree with the comments above. For whatever problem you’re trying to solve, there are usually better solutions. However, just for illustrative purposes, here’s one (very ugly) solution: ‘use strict’ function jamie (){ var callerName; try { throw new Error(); } catch (e) { var re = /(\w+)@|at (\w+) \(/g, st … Read more

What does "use strict" do in JavaScript, and what is the reasoning behind it?

Update for ES6 modules Inside native ECMAScript modules (with import and export statements) and ES6 classes, strict mode is always enabled and cannot be disabled. Original answer This article about Javascript Strict Mode might interest you: John Resig – ECMAScript 5 Strict Mode, JSON, and More To quote some interesting parts: Strict Mode is a … Read more