#Component Library Nested files
15 messages ยท Page 1 of 1 (latest)
๐๐ปโโ๏ธ
did you give a look to this one
๐๐ป https://qwik.builder.io/docs/advanced/library/
yes, this is what I mean, that I have to export everything in the src/index.ts
so I cannot import stuff like:
my-lib/some-path/some-component
and this would be really useful if I have a good amount of components
I'm not much familiar with the lib-ability of Qwik yet. I see it produces a commonjs and module files
pnpm run build.lib
looking at the .mjs file, I see it exports each component
I presume that your Qwik app that consumes the lib, will bundle only the exported components being used
you can actually configure whatever paths you want by changing your package.json exports field
but the consumer of your library will probably be using a "tree-shaking" bundler (vite etc) that will remove any other exports anyway, so it doesn't matter too much
Thank you for the answers! ๐ I know I can have multiple exports in the package.json, the question is can I have multiple output files for the build itself.
Or I have to create my own build, and just make sure I am building filename.qwik.js files?
@broken lintel This is a problem we are actively trying to solve for qwik-ui as well, and it doesn't seem to be an easy one..
So far we have found a way to separate each bundles with the help of vite.config.ts, but we currently have a rollup issue in production.
Feel free to hang out on the qwikifiers discord to check up the advancement of all this.
Also there a github issue you can follow: https://github.com/qwikifiers/qwik-ui/issues/453
A workaround at the moment would be to create multiple separate packages like radix/ui primitives for each component of your library