Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-preset-rax

Package Overview
Dependencies
Maintainers
4
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-rax

Babel preset for all Rax plugins.

  • 1.0.0-beta.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
377
decreased by-33.74%
Maintainers
4
Weekly downloads
 
Created
Source

babel-preset-rax npm Dependency Status Known Vulnerabilities

Babel preset for all Rax plugins.

This preset always includes the following plugins:

And with the development option:

Installation

Using npm:

npm install --save-dev babel-preset-rax

or using yarn:

yarn add babel-preset-rax --dev

Usage

.babelrc

Without options:

{
  "presets": ["babel-preset-rax"]
}

With options:

{
  "presets": [
    [
      "babel-preset-rax",
      {
        "pragma": "dom", // default pragma is createElement
        "pragmaFrag": "DomFrag", // default is Fragment
        "throwIfNamespace": false // defaults to true
      }
    ]
  ]
}

Via CLI

babel --presets babel-preset-rax script.js

Via Node API

require("@babel/core").transform("code", {
  presets: ["babel-preset-rax"],
});

Options

pragma

string, defaults to createElement.

Replace the function used when compiling JSX expressions.

pragmaFrag

string, defaults to Fragment.

Replace the component used when compiling JSX fragments.

useBuiltIns

boolean, defaults to false.

Will use the native built-in instead of trying to polyfill behavior for any plugins that require one.

development

boolean, defaults to false.

Toggles plugins that aid in development, such as @babel/plugin-transform-react-jsx-self and @babel/plugin-transform-react-jsx-source.

This is useful when combined with the env option configuration or js config files.

throwIfNamespace

boolean, defaults to true.

Toggles whether or not to throw an error if a XML namespaced tag name is used. For example:

<f:image />

Though the JSX spec allows this, it is disabled by default since React's JSX does not currently have support for it.

.babelrc.js
module.exports = {
  presets: [
    [
      "babel-preset-rax",
      {
        development: process.env.BABEL_ENV === "development",
      },
    ],
  ],
};
.babelrc

Note: the env option will likely get deprecated soon

{
  "presets": ["babel-preset-rax"],
  "env": {
    "development": {
      "presets": [["babel-preset-rax", { "development": true }]]
    }
  }
}

FAQs

Package last updated on 10 Dec 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc