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

Added a rollup config section to the readme #398

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,32 @@ First, install it: `npm install --save-dev aliasify`
}
```

## Usage with Rollup

Using `preact-compat` with rollup requires [rollup-plugin-alias](http://npm.im/rollup-plugin-alias)

First, install it: `npm install --save-dev rollup-plugin-alias`

... then in your `rollup.config.js`, configure the alias plugin to point to `react`, `react-dom`, and optionally `create-react-class`, along with the rest of the plugins:

```js
import path from "path";
import alias from "rollup-plugin-alias";
// ...

export default {
// ...
plugins: [
// ...
alias({
"react": path.resolve(__dirname, "node_modules", "preact-compat", "dist", "preact-compat.es.js"),
"react-dom": path.resolve(__dirname, "node_modules", "preact-compat", "dist", "preact-compat.es.js"),
"create-react-class": path.resolve(__dirname, "node_modules", "preact-compat", "lib", "create-react-class.js")
}),
// ...
}
```

## Usage with Babel

Using `preact-compat` with Babel is easy.
Expand Down