Skip to content

Commit

Permalink
docs(virtual): example use for bundle input (#323)
Browse files Browse the repository at this point in the history
* Add example for passing code to Rollup's input

* docs: reposition entrypoint example and reword

Co-authored-by: Andrew Powell <[email protected]>
  • Loading branch information
PierBover and shellscape authored Apr 22, 2020
1 parent 5d2dcf4 commit e9651fb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/virtual/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,27 @@ Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#comma

This plugin has no formal options. The lone parameter for this plugin is an `Object` containing properties that correspond to a `String` containing the virtual module's code.

## Using the Plugin for Bundle Input

It's possible to use the plugin to specify an entry point for a bundle. To do so, implement a pattern simple to what is shown below:

```js
import virtual from '@rollup/plugin-virtual';

export default {
input: 'entry',
// ...
plugins: [
virtual({
entry: `
import batman from 'batcave';
console.log(batman);
`
})
]
};
```

## License

[MIT](LICENSE)

0 comments on commit e9651fb

Please sign in to comment.