Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@volvo-cars/babel-preset-react-app
Advanced tools
This package includes a Babel preset suitable for React apps and libraries at Volvo Cars.
This preset uses the useBuiltIns
option with some transforms, which assumes that Object.assign
is available or polyfilled. It should be if you use @babel/polyfill
or @volvo-cars/polyfill.
npm install @volvo-cars/babel-preset-react-app
# or
yarn add @volvo-cars/babel-preset-react-app
Add the following to your .babelrc
or "babel"
in package.json
:
{
"presets": ["@volvo-cars/babel-preset-react-app"]
}
You should not need any other presets (like preset-env
or preset-react
) for production builds. If you are missing a transform that you believe can be useful, feel free to make a pull request to this preset to add it.
To compile your code add something like this to your package.json:
{
"main": "lib/index.js",
"module": "es/index.js",
"files": ["lib", "es"],
"scripts": {
"build:lib": "babel src --out-dir lib --delete-dir-on-start",
"build:es": "babel src --env-name esmodules --out-dir es --delete-dir-on-start",
"build": "yarn run build:lib && yarn run build:es"
}
}
To avoid duplicating Babel's helper functions in each compiled file, you can do
yarn add @babel/runtime@^7.4.0
{
"presets": [["@volvo-cars/babel-preset-react-app", { "importHelpers": true }]]
}
This is not the default because it requires an extra package to be installed, but is highly recommended.
importHelpers
(boolean
, defaults to false
) - Replace Babel helpers (classCallCheck, extends, etc) are with imports from @babel/runtime
.targets
- Describes the compile target/browser support. See @babel/preset-env#targets. By default uses @volvo-cars/browserslist-config.modules
- The module format to target. See @babel/preset-env#modulesTo compile for different targets but otherwise using the same config, you can use Babel's --env-name
flag to set some options.
--env-name esmodules
- Sets modules: false
to make sure modules are not compiled to Common JS.FAQs
Babel preset for React apps in Volvo Cars
We found that @volvo-cars/babel-preset-react-app demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.