Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
babel-preset-gatsby
Advanced tools
Gatsby uses the phenomenal project [Babel](https://babeljs.io/) to enable support for writing modern JavaScript — while still supporting older browsers. This package contains the default Babel setup for all Gatsby projects.
Gatsby uses the phenomenal project Babel to enable support for writing modern JavaScript — while still supporting older browsers. This package contains the default Babel setup for all Gatsby projects.
For more information on how to customize the Babel configuration of your Gatsby site, check out our documentation.
@babel/preset-env
@babel/preset-react
@babel/plugin-proposal-class-properties
@babel/plugin-syntax-dynamic-import
@babel/plugin-transform-runtime
babel-plugin-macros
babel-plugin-transform-react-remove-prop-types
@babel/plugin-proposal-nullish-coalescing-operator
@babel/plugin-proposal-optional-chaining
babel-plugin-optimize-hook-destructuring
Install babel-preset-gatsby
and add a .babelrc
file with the following content to the root of your project:
npm install --dev babel-preset-gatsby
{
"presets": ["babel-preset-gatsby"]
}
targets
{ [string]: number | string }
, defaults to { "browsers": ["last 4 versions", "safari >= 7", "ie >= 9"] }
in production and { "browsers": ["last 2 versions", "not ie <= 11", "not android 4.4.3"] }
in development when targeting the browser and { "node": 6 }
in production and { "node": "current" }
in development when targeting Node.js.
Use this option to configure custom target browsers.
reactRuntime
'classic' | 'automatic'
, defaults to 'classic'
. Allows the use of JSX without having to import React (learn more in the official blog post). If you only want to set the runtime to automatic
without a custom JSX transformer, you can use the gatsby-config
option.
reactImportSource
string
, defaults to null
. Set which package React should use as underlying JSX transformer. For example you can set it to @emotion/react
so by default @emotion/react
is used instead of the react package. In order to use reactImportSource
you must set reactRuntime
to automatic.
Example:
{
"presets": [
[
"babel-preset-gatsby",
{
"reactRuntime": "automatic",
"reactImportSource": "@emotion/react"
}
]
]
}
FAQs
Gatsby uses the phenomenal project [Babel](https://babeljs.io/) to enable support for writing modern JavaScript — while still supporting older browsers. This package contains the default Babel setup for all Gatsby projects.
The npm package babel-preset-gatsby receives a total of 237,605 weekly downloads. As such, babel-preset-gatsby popularity was classified as popular.
We found that babel-preset-gatsby demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.