Open amerllica opened 3 years ago
@amerllica did you find a better solution for this (besides loadable)?
@oxodesign, Not yet buddy, but @SaeedPadyab nominate another way:
import loadable from '@loadable/component';
const Button = loadable(
() =>
import('TSDX-Package/src/Button'),
{
ssr: false,
}
);
I test it, it works and tree-shake happens but I'm not sure it is a good way or not. reading from src
. I'm now sure about it, but it works properly.
We are making our UI-kit by using
tsdx
and it contains some components and we just want to import one instead of all (lazy byloadable-component
):Current Behavior
We should import everything like this:
Desired Behavior
I wanted to import my components like this:
Sample of use case
⚠️ It's not our solution:
The below solution works but
tree-shake
won't happen, we will have whole the package in the bundle.