{"id":19283,"library":"babel-preset-es2015-nostrict","title":"babel-preset-es2015-nostrict","description":"A Babel preset that includes all ES2015 plugins but suppresses the automatic insertion of 'use strict' at the top of compiled modules. This is useful for projects that need to avoid strict mode globally (e.g., when concatenating scripts or using non-strict dependencies). The preset mirrors babel-preset-es2015 (v6.6.2) but without the strict-mode directive. It was released in 2015-2016 as part of the Babel 6 ecosystem. This package is now obsolete; Babel 7+ deprecates presets like this in favor of @babel/preset-env with the 'modules' and 'config' options. Key differentiator: removes strict-mode enforcement for legacy code compatibility.","status":"deprecated","version":"6.6.2","language":"javascript","source_language":"en","source_url":"https://github.com/alexykot/babel/tree/master/packages/babel-preset-es2015-nostrict","tags":["javascript"],"install":[{"cmd":"npm install babel-preset-es2015-nostrict","lang":"bash","label":"npm"},{"cmd":"yarn add babel-preset-es2015-nostrict","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-preset-es2015-nostrict","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This preset modifies the standard es2015 preset by removing the 'use strict' insertion.","package":"babel-preset-es2015","optional":false}],"imports":[{"note":"This preset is not imported as a JavaScript module; it is referenced by name in Babel configuration.","wrong":"// Wrong: require('babel-preset-es2015-nostrict') directly without using the preset string","symbol":"preset","correct":"// In .babelrc: { \"presets\": [\"es2015-nostrict\"] }"},{"note":"Avoid using .default; the module exports the preset function directly.","wrong":"var preset = require('babel-preset-es2015-nostrict').default;","symbol":"babel-preset-es2015-nostrict","correct":"require('babel-preset-es2015-nostrict')"},{"note":"Refer to the preset by string name, not by requiring it directly in the presets array.","wrong":"require('babel-core').transform(code, { presets: [require('babel-preset-es2015-nostrict')] })","symbol":"babel-core (transform API)","correct":"require('babel-core').transform(code, { presets: ['es2015-nostrict'] })"}],"quickstart":{"code":"// 1. Install:\n// npm install --save-dev babel-preset-es2015-nostrict babel-cli\n\n// 2. .babelrc\n{\n  \"presets\": [\"es2015-nostrict\"]\n}\n\n// 3. Run:\n// babel script.js --out-file compiled.js\n\n// Example input (ES2015):\nconst greet = name => `Hello, ${name}!`;\n\n// Output (no 'use strict'):\nvar greet = function greet(name) {\n  return 'Hello, ' + name + '!';\n};","lang":"javascript","description":"Shows installation, configuration via .babelrc, and demonstrates that strict mode is omitted in output."},"warnings":[{"fix":"Migrate to Babel 7+ and use @babel/preset-env. To disable strict mode, set 'modules' to 'false' or use 'loose' transforms.","message":"babel-preset-es2015-nostrict is deprecated in favor of using @babel/preset-env with the 'modules' option and appropriate config.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Add babel-polyfill as a separate import or use @babel/preset-env with useBuiltIns.","message":"The preset does not include any polyfills; it only transforms syntax. You may need babel-polyfill for runtime features like Promise or Symbol.","severity":"breaking","affected_versions":"all"},{"fix":"If you need strict mode in some files, consider splitting your build process or using the standard babel-preset-es2015.","message":"Without 'use strict', code may run in sloppy mode, which can expose differences in behavior (e.g., with this binding, reserved words).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev babel-preset-es2015-nostrict'","cause":"The preset is not installed as a devDependency.","error":"Error: Cannot find module 'babel-preset-es2015-nostrict'"},{"fix":"Ensure .babelrc contains { \"presets\": [\"es2015-nostrict\"] } and that babel-cli or babel-register is used.","cause":"Babel is not configured to transform ES2015 modules, or the preset is not applied correctly.","error":"SyntaxError: Unexpected token import"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}