-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose JS API to combine multiple outputs into one #188
Comments
There is a CLI tool for this https://github.com/btd/rollup-plugin-visualizer#cli already. Not sure if i want to support merge as API |
Basically merge happen there https://github.com/btd/rollup-plugin-visualizer/blob/master/bin/cli.ts#L70C3-L102C5 |
I would prefer the entire rollup-plugin-visualizer/bin/cli.ts Lines 104 to 107 in dec8398
|
I'm working on a framework for building chrome extensions, WXT, that includes this plugin when running
wxt build --analyze
. Chrome extensions contain multiple bulid steps, so each step outputs a separate stats JSON file, and then therollup-plugin-visualizer
CLI is used to combine them.However, this doesn't work out of the box when using
pnpm
andshamefully-hoist=true
(the default). This is because the binary isn't included innode_modules/.bin
, so it's not in the path. Instead, the binary is stored atnode_modules/wxt/node_modules/.bin/rollup-plugin-visualizer
. There might be a similar problem for yarn PnP, haven't tested it.I could add
node_modules/wxt/node_modules/.bin
to the path while callingspawn("rollup-plugin-visualizer")
(and I likely will do that as a workaround for now), but I'd also like to just call a function instead of spawning a new process, something like this:After looking at the code, I think this is a pretty simple change. Just involves exporting
runForPluginJson
fromplugin/index.ts
, or another entrypoint if that doesn't make sense.rollup-plugin-visualizer/bin/cli.ts
Line 56 in dec8398
If that sounds OK, I'm willing to work on this and open a PR!
The text was updated successfully, but these errors were encountered: