Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Commit

Permalink
added HOWTO to alias in Babel (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
sskoopa authored and developit committed Oct 27, 2016
1 parent 96d133b commit 45d4874
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Expand Up @@ -89,6 +89,34 @@ First, install it: `npm install --save-dev aliasify`
}
```

## Usage with Babel

Using `preact-compat` with Babel is easy.

Install the babel plugin for aliasing: `npm install --save-dev babel-plugin-module-resolver`

All you have to do is tell babel to process jsx with 'h' and add an alias for `react` and `react-dom` in your .babelrc:

```js
{
// ...
"plugins": [
["transform-react-jsx", { "pragma":"h" }],
["module-resolver", {
"root": ["."],
"alias": {
"react": "preact-compat",
"react-dom": "preact-compat"
}
}]
],
"presets": [
"react"
]
// ...
}
```


## Once Aliased

Expand Down

0 comments on commit 45d4874

Please sign in to comment.