Skip to content

Commit

Permalink
feat: add visualizer to the plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Oct 16, 2020
1 parent ad000fb commit 6ad1f0f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ createPlugins(
which `inputPlugins` is among these:

```
js (considered by default)
ts
babel
coffee
json
css
wasm
(js is considered by default)
visualizer
```

You can pass an input plugin with their supported option:
Expand Down
13 changes: 13 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,19 @@ export function createPlugins(
}
}

// visualizer
const visualizerIndex = includesAny(inputPluginsNames, ["visualizer", "plot"])
if (visualizerIndex !== null) {
const visualizer = require("rollup-plugin-visualizer")
if (typeof inputPluginsNames[visualizerIndex] === "string") {
// plugin name only
plugins.push(visualizer({sourcemap: true, open: true}))
} else {
// plugin with options
plugins.push(visualizer(inputPluginsNames[visualizerIndex][1]))
}
}

// extra plugins
if (typeof extraPlugins !== "boolean" && extraPlugins !== undefined) {
try {
Expand Down

0 comments on commit 6ad1f0f

Please sign in to comment.