Export components from module
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 275
- Forks
- 35
- Avg merge
- 4h 42m
- Merged PRs (30d)
- 6
Description
How can I export components from module?
For example, if I don't want to autoimport specific component or if consumer wants to import component explicitly.
I managed to find a way to export like this:
src/runtime/components/index.ts
export { default as Foo } from './foo.vue'
package.json
...
"exports": {
...
"./components": {
"types": "./dist/runtime/components/index.d.ts",
"import": "./dist/runtime/components/index.js"
}
},
But when I import Foo from my package, although its seems to work, the component has type any.
You can check details of my setup in this repo
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/runtime/components/index.ts and the package.json exports entry shown in the issue, then reproduce the setup from the linked repository. Trace how the component declaration is generated and exposed through the package entry point. Done means explicitly imported components retain their correct type instead of being typed as any.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100