1.0.0-beta.0 • Published 6 years ago

babel-preset-rax v1.0.0-beta.0

Weekly downloads
1,931
License
BSD-3-Clause
Repository
github
Last release
6 years ago

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

Via .babelrc (Recommended)

.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 }]]
    }
  }
}
1.0.0-beta.0

6 years ago

0.6.5

6 years ago

0.6.4-3

6 years ago

0.6.4-2

6 years ago

0.6.4-1

6 years ago

0.6.4

6 years ago

0.6.3

7 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.4

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.20

7 years ago

0.4.19

7 years ago

0.4.18

7 years ago

0.4.17

7 years ago

0.4.16

7 years ago

0.4.15

7 years ago

0.5.0-beta

7 years ago

0.4.14

7 years ago

0.4.13

7 years ago

0.4.12

7 years ago

0.4.11

7 years ago

0.4.10

7 years ago

0.4.9

7 years ago

0.4.8

7 years ago

0.4.7

7 years ago

0.4.6

7 years ago

0.4.5

7 years ago

0.4.4

7 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.8

7 years ago

0.3.7

7 years ago

0.3.6

7 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.11

8 years ago

0.2.10

8 years ago

0.2.9

8 years ago

0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.0

8 years ago

0.0.1

8 years ago