crcong / vite-plugin-externals

use to external resources
MIT License
166 stars 21 forks source link

Support `export * from 'module'` #19

Open troy351 opened 2 years ago

troy351 commented 2 years ago

I want to external vue, but it export * from 'vue' seems doesn't handled by this plugin.

FYI. the problem was from vue-demi

crcong commented 2 years ago

I guess you import vue module by vue-demi. Such as import { reactive } from 'vue-demi ?

troy351 commented 2 years ago

I didn't, actually pinia does.

crcong commented 2 years ago

Can you provide minimal reproduction? I not quite sure your situation. Thanks.

troy351 commented 2 years ago

Just create a new vite project with vue 2.7, import and init pinia.

Set external vue from this plugin.

I did some debug and found out it was caused by vue-demi as the original issue said

crcong commented 2 years ago

I got it. Thanks. I will as soon as possible to deal with it. : )

troy351 commented 2 years ago

Further more, I changed export * from 'vue' to export { ref, onCreated, ...other-pinia-used-imports} from 'vue', it works again.

So I did this modification as a temporary workaround.

nonzzz commented 1 year ago

I write a new plugin to resolve those question. can take a look vite-plugin-cdn2. you can donwload the project and run the example. It provide a minimal example ( contain unplugin-vue-component,pinia)

image