Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
babel-preset-env
Advanced tools
babel-preset-env is a smart preset that allows you to use the latest JavaScript without needing to micromanage which syntax transforms (and optionally, browser polyfills) are needed by your target environment(s). It automatically determines the Babel plugins and polyfills you need based on your supported environments.
Automatic Polyfilling
Automatically includes polyfills for the features you use based on your target environments. The 'useBuiltIns' option set to 'usage' ensures that only the necessary polyfills are included.
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": 3
}
]
]
}
Targeting Specific Environments
Allows you to specify the environments you want to support. The 'targets' option lets you define the browsers or Node.js versions you want to transpile your code for.
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
}
]
]
}
Debugging
Enables debug mode to print useful information about the targets and plugins being used. This helps in understanding what transformations are being applied.
{
"presets": [
[
"@babel/preset-env",
{
"debug": true
}
]
]
}
@babel/preset-react is a Babel preset that includes plugins needed to transform React JSX syntax. It is specifically tailored for React applications, whereas babel-preset-env is more general-purpose.
@babel/preset-typescript is a Babel preset that allows Babel to transform TypeScript code into JavaScript. It focuses on TypeScript syntax, while babel-preset-env focuses on modern JavaScript features.
core-js is a library that provides polyfills for modern JavaScript features. While babel-preset-env can automatically include core-js polyfills based on usage, core-js itself is a standalone library for polyfilling.
Babel preset for all envs.
$ npm install --save-dev babel-preset-env
.babelrc
targets
- an object of browsers/environment versions to support. The data for this is currently at: https://github.com/babel/babel-preset-env/blob/master/src/plugins.js (It would be nice to move this to use a data source like kangax.github.io/compat-table). And we would like help to make the data is correct!loose
- Enable "loose" transformations for any plugins in this preset that allow them (Disabled by default).modules
- Enable transformation of ES6 module syntax to another module type (Enabled by default to "commonjs"
).
false
to not transform modules, or one of ["amd", "umd", "systemjs", "commonjs"]
{
"presets": [
["env", {
"targets": {
"chrome": 52
},
"loose": true,
"modules": false
}]
]
}
FAQs
A Babel preset for each environment.
The npm package babel-preset-env receives a total of 533,094 weekly downloads. As such, babel-preset-env popularity was classified as popular.
We found that babel-preset-env demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.