TypeStrong / dts-bundle

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

Fails to process when it has non relative imports #22

Closed grofit closed 8 years ago

grofit commented 9 years ago

It seems to blow up when I have a reference in one d.ts to Bluebird which looks like this:

import * as Promise from "bluebird";

It gives the error:

TypeError: Cannot read property 'file' of undefined
    at C:\Code\Web\test\node_modules\dts-bundle\lib\index.js:125:55

The config being used is:

dtsBundle.bundle({
        name: pkg.name, // Lets call it "test"
        main: paths.output + "/definitions/index.d.ts", // Lets call it dist/definitions/index.d.ts
        out: paths.output + "/" + pkg.name + '.d.ts' // dist/definitions/test.d.ts
    });

Much like you I have a typings folder, but it is external to where the d.ts files are spat out, do I need to provide a link to them in the options somehow?

SimoneGianni commented 9 years ago

I was facing the same error, and as a temporary workaround to this problem on my machine, in index.js file line 124 before the if that gives error i added "if (!p) return;"

In my case, i did not want to include the typings of those libraries, cause they are already defined where later used in other projects.

tolemac commented 8 years ago

+1 https://github.com/TypeStrong/dts-bundle/pull/27