Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-entry imports #353

Closed
liyuanqiu opened this issue Nov 27, 2019 · 3 comments · May be fixed by #367
Closed

Support multi-entry imports #353

liyuanqiu opened this issue Nov 27, 2019 · 3 comments · May be fixed by #367
Labels
solution: duplicate This issue or pull request already exists topic: multi-entry Related to multi-entry support

Comments

@liyuanqiu
Copy link

Current Behavior

For ESM, TSDX bundles all code into one file(dist/xxx.esm.js)

Desired Behavior

src
├── Button
│   └── index.tsx
├── Checkbox
│   └── index.tsx
└── Radio
    └── index.tsx

See this directory hierarchy, it is desired that TSDX can generate dist like this:

dist
├── Button
│   └── index.js
├── Checkbox
│   └── index.js
└── Radio
    └── index.js

So I can import them using:

import { R: ButtonForReact, V: ButtonForVanilla } from 'mylib/Button';
import { R, V } from 'mylib/Checkbox';

It is useful to avoid the hell of naming things when I have many features in one NPM package. I can use the directories as namespaces.

Suggested Solution

Add an option in TsdxOptions to active this feature, default to false.

Who does this impact? Who is this for?

For those who got a headache in naming things.

Describe alternatives you've considered

Think about tsc, it generates code files right beside the source files. Just want the same behavior.

Additional context

@swyxio
Copy link
Collaborator

swyxio commented Dec 4, 2019

thanks, this is a popular feature request. i dont know what the right solution is.

@swyxio swyxio added the kind: feature New feature or request label Dec 4, 2019
@vongohren
Copy link

Cant this be done with some rollup codesplitting config? https://levelup.gitconnected.com/code-splitting-for-libraries-bundling-for-npm-with-rollup-1-0-2522c7437697

@swyxio
Copy link
Collaborator

swyxio commented Dec 23, 2019

thanks folks - gonna close this as a duplicate of #365 - as i think we're gonna call it multi entry. follow that issue.

@swyxio swyxio closed this as completed Dec 23, 2019
@agilgur5 agilgur5 changed the title Support importing from absolute path Support multi-entry imports Mar 10, 2020
@agilgur5 agilgur5 added solution: duplicate This issue or pull request already exists topic: multi-entry Related to multi-entry support and removed kind: feature New feature or request labels Mar 10, 2020
@agilgur5 agilgur5 linked a pull request Jul 7, 2020 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution: duplicate This issue or pull request already exists topic: multi-entry Related to multi-entry support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants