Dschungelabenteuer / vite-plugin-entry-shaking

Mimic tree-shaking behaviour when importing code from an entry file in development mode.
MIT License
124 stars 8 forks source link

Plugin stop going deeper to translate the re-export from the other packages #19

Closed jeldalam closed 1 year ago

jeldalam commented 1 year ago

Hi, thanks for this plugin. It help our project a lot in reduce file requests. But I notice the process of auto translate the import URL is just support the first level, when the imported package is exporting the other package's components from the same workspace it not going forward to process.

For example:

// module.ts import { a, b} from 'packageA'; import { c } from 'packageA';

// packageA/index.ts export { a } from './a'; export { b } from './b'; export { c } from 'packageB';

// packageB/index.ts export { c } from './c';

component a and b import statement is perfect translated to: import { a } from 'packageA/a'; import { b } from 'packageA/b';

but component c is not being able to do the same, it translated to: import { c } from 'packageB/index';

It would be nice if the plugin can handle this case, it will bring the flexibility in more use cases.

jeldalam commented 1 year ago

Sorry, my network causing the duplicated issue, please delete it.