-
Notifications
You must be signed in to change notification settings - Fork 362
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
[Question] Sub-exports depending on main export bundle the entire main-export. #1027
Comments
You need to import the package name in your source, not the entry filename: // index.ts
export * from './main';
// main.ts
export class Thing {}
// a.ts
import {Thing} from 'package';
export class OtherThing extends Thing {} |
Thanks a lot for the quick response! I tried that, and first got the following error:
So I tried to tell typescript about the package:
That compiles without error, but unfortunately didn't change anything in the output (still contains everything from the main.ts in a.ts' output). The next thing I tried was to instead specify the path as
but that leads to the following error:
I finally solved it, by explicitly telling microbundle to treat the module as external (and using the first solution from above to make typescript happy):
Is that something that microbundle should have been able to pick up on automatically? |
I ran into a similar issue - @usefulthink your solution worked, but it means the UMD build now contains a |
I have a project where I have a main-export and multiple other exports. The other exports are extensions that depend on the main-export, but I don't want them to be in the main-export to keep it as small as possible.
Users should be able to do:
(or similarly using multiple script-tags with the umd-builds)
As for the source-files, it's roughly like this:
And the package.json contains these sub-exports:
With this, the output-files for '
./a
' (all formats) have the entire definition of './main.ts
' inlined.So my question is, is there a way to configure microbundle to treat those other files as externals?
The text was updated successfully, but these errors were encountered: