rollup-plugin-visualizer
rollup-plugin-visualizer copied to clipboard
`visualize()` returns wrong type when loading from `vite` in TypeScript.
OS & Node info
- Operating System:
Darwin(Mac OS) - Node Version:
v16.14.2 - Nuxt Version:
3.0.0-rc.9 - Package Manager:
[email protected] - Builder:
vite - Runtime Modules:
unplugin-icons/nuxt,@vueuse/[email protected],@intlify/[email protected] - Build Modules:
-
Screenshot of the problem

I guess this is missing the Rollup config, which I'm not sure how to extract from nuxt, but I guess I can work on it if found helpful.
Hi. Thanks for report. Need some details. There was similar issue recently.
Can you please run yarn ls rollup and yarn ls rollup-plugin-visualizer. I do not remember if yarn has ls command, if not try with npm pls.
Hello. I had the same phenomenon here.
It seems to be caused by a change in the Rollup Plugin type at some point and older versions of Vite cannot handle it.
In my environment, lowering the Rollup version to <=2.77.3 or raising the Vite version to >=3.1.0 works fine.
npm i -D [email protected]
or
npm i -D [email protected]
Hello, thanks @btd for the quick reply! Here are the reports:
npm ls rollup:

npm ls rollup-plugin-visualizer:

@n4o847 It doesn't seem to work unfortunately... Here is the current vite I am using:

Problem is that you have 2 rollup versions, and it seems 2.79 are in root. I hoped vite 3.1 will update rollup, but it seem they did not. That change created so much mess. I will see if i can reorganize type structure, but i am worry it will be not possible until vite will align with last version of rollup. As workaround you can pin rollup to 2.78 or just cast plugin to PluginOptions
I will probably close this as on my side there is no anything i can do for now. This issue actually must be created on vite+rollup side as they created mess with last releases. Vite 3.1 limit rollup version to 2.78.x Most of rollup plugins has rollup in peerDependencies, and a lot of them do not have complimentary meta entry to mark it optional. This causes always 2 rollup installations. One for vite and one for plugin. I fixed this in this plugin, but this could be caused now by any plugin now it seems. Which one will install rollup in the root first. If never installed in the root, when ts will see config for vite will use it its types.