fengxinming / vite-plugins

Some custom plugins for vitejs.
https://fengxinming.github.io/vite-plugins/
MIT License
70 stars 6 forks source link

Only works when format is iife or umd? #13

Open IanVS opened 1 year ago

IanVS commented 1 year ago

I experimented with vite-plugin-externals, but it didn't seem to have any effect. Then I came across https://github.com/rollup/rollup/issues/2374, which notes that external and output.globals only work with iife or umd output formats. Maybe there should be a disclaimer in the readme to explain that?

fengxinming commented 1 year ago

@IanVS vite-plugin-external or vite-plugin-externals? Would you mind if I got an example from you about this issue, actually I do not know this issue https://github.com/rollup/rollup/issues/2374 because I never do output.globals and esm output format together.

IanVS commented 1 year ago

Sorry, vite-plugin-external. I was trying to use this plugin along with vite in middleware mode to replace references to internal storybook packages with references from the global scope. https://github.com/storybookjs/storybook/pull/19978 is the PR where I ended up using https://www.npmjs.com/package/rollup-plugin-external-globals instead.