You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a TypeScript package with a number of types in different files underneath a src/resources directory. Though these files and their types are alternately imported and/or exported from src/index.ts (which is my entry point/source within package.json), many of them are excluded, unless I export * all the way down.
Just from experimenting, it looks like:
types that are exported via export * from './location' from the entry point are included in the build, but types that are exported via export { Type } from './location' are not
this is true recursively as well: if the entry point includes export * from './location' and ./location/index.ts includes export { Type } from './type', a d.ts file will be created at ./dist/location/index.d.ts that references a non-existent ./dist/location/type.d.ts
Expected behavior: if I export { Type } from './location' from an entry point, then './dist/location.d.ts is created/built, ideally with only the types or other resources that have been exported or depended on from the entry point.
Workaround: run tsc src/index.ts --outDir dist --declaration --emitDeclarationOnly --esModuleInterop AFTER running microbundle to create ALL types referenced by entry point. This doesn't prune unused types, but it's a start!
I'm hoping this is just user error, please let me know if I have a problem in my package.json or tsconfig.json or if this isn't a use case that microbundle is focusing on. Thanks all for building a sweet bundler!
The text was updated successfully, but these errors were encountered:
I have a TypeScript package with a number of types in different files underneath a
src/resources
directory. Though these files and their types are alternately imported and/or exported fromsrc/index.ts
(which is my entry point/source
withinpackage.json
), many of them are excluded, unless Iexport *
all the way down.Just from experimenting, it looks like:
export * from './location'
from the entry point are included in the build, but types that are exported viaexport { Type } from './location'
are notexport * from './location'
and./location/index.ts
includesexport { Type } from './type'
, ad.ts
file will be created at./dist/location/index.d.ts
that references a non-existent./dist/location/type.d.ts
Expected behavior: if I
export { Type } from './location'
from an entry point, then'./dist/location.d.ts
is created/built, ideally with only the types or other resources that have been exported or depended on from the entry point.Workaround: run
tsc src/index.ts --outDir dist --declaration --emitDeclarationOnly --esModuleInterop
AFTER running microbundle to create ALL types referenced by entry point. This doesn't prune unused types, but it's a start!Small sample to reproduce: https://github.com/carpeliam/microbundle-where-are-my-types
I'm hoping this is just user error, please let me know if I have a problem in my
package.json
ortsconfig.json
or if this isn't a use case that microbundle is focusing on. Thanks all for building a sweet bundler!The text was updated successfully, but these errors were encountered: