@coasys/rollup-plugin-holochain
Version:
Rollup-plugin to load Holochain DNA or hApp bundle files as modules returning a string with base64 encoded binary data.
35 lines (27 loc) • 849 B
Markdown
# rollup-plugin-holochain
(former name: rollup-plugin-dna)
Rollup-plugin to load Holochain DNA or hApp bundle files as modules returning a string with base64 encoded binary data.
## Usage
```javascript
import dna from './hc-dna/languages.dna'
export const DNA = Buffer.from(dna, 'base64')
import happ from './hc-dna/workdir/my-app.happ'
export const BUNDLE = Buffer.from(dna, 'base64')
```
## Installation
```
npm i @coasys/rollup-plugin-holochain -D
```
## Config
In your `rollup.config.js`:
```javascript
import { dna, happ } from '@coasys/rollup-plugin-holochain`
export default {
...
plugins: [
dna(),
happ()
]
}
```
The `dna` plugin will only load files ending with .dna and creates an export called `dna`, while the happ pluging will only load files ending with .happ and it creates an export called `happ`.