TypeStrong / dts-bundle

Export TypeScript .d.ts files as an external module definition
MIT License
308 stars 57 forks source link

bundler fails when files are imported by directory name (CommonJS idiom) #38

Closed bjouhier closed 7 years ago

bjouhier commented 8 years ago

My main .d.ts file contained a line like:

// ./foo is subdirectory containing an `index.d.ts` file
import * as foo from './foo'; 

This failed. I fixed it by replacing ./foo by ./foo/index.

tolemac commented 8 years ago

Do you mean to the original .d.ts file? generated by tsc ??

Can you paste here the error output?

Thanks.

tolemac commented 8 years ago

@bjouhier can you help me to reproduce the problem?

kcjmowright commented 8 years ago

I had the same problem. I finally have the right fix for this with a test. The test recreates the conditions reported by @bjouhier . The plugin doesn't generate an error, but the TSC complains when trying to consume the generated d.ts created by this plugin. The fix produces the expected d.ts as the test results will show.

See https://github.com/TypeStrong/dts-bundle/pull/42

lifenautjoe commented 8 years ago

As the repository contributors seem to be absent I have created a fork of the package with the PR which solves this merged.

Just replace npm dts-bundle package by dts-bundle-hot-fix .

tolemac commented 7 years ago

I will take a look to it the nexts days.

tolemac commented 7 years ago

0.6.0 npm version released. Thanks!