-
Notifications
You must be signed in to change notification settings - Fork 74
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
Cannot find ambient module declaration in .d.ts #256
Comments
Thanks for opening such a thorough issue. Unfortunately, I don't have the time, at the moment, to figure out why this isn't working for you, but I do have some suggestions:
Good luck. |
Thanks for the reply. Here are my findings:
|
How TypeScript resolves modules - and what it considers to be valid - does not matter. What might matter is how Browserify does it. And what Browserify considers to be valid. The algorithm used by Browserify - and Node - is explained here. I'm also a Windows developer. I would not recommend putting the environment variable into the system variables. Specify it on the command line and use Git Bash or a similar shell. |
The following locations for the ambient declaration were tried and with no success
Again, when I tried to keep the file in both of these locations the Gulp task complained about a duplicate identifier. I believe this means the file was, in fact, found. Therefore I believe the error is not in the location. Another reason to believe the locations are correct is that when I completely remove the file there is not 1 error but 2 errors in the Gulp task execution: And I'm sorry, I'm having no luck with setting up the logging. I've put NODE_DEBUG into my .bashrc and I'm running Gulp from within Git Bash. But I have no idea what to do next in order to actually see some more info about my error from within Browserify/Tsify. |
The environment variable doesn't go into a configuration file; it's specified on the command line, immediately before the command you want to run - as in the doc to which I referred you. The duplicate error you are.getting is a TS error. The initial error you mentioned in the issue is - IMO - most likely a Browserify error. Have a looks at what Unfortunately, I no longer use |
Well, thanks for your effort anyway. |
@mnovotny I encountered the same situation as you, and found the answer. Maybe the same method can help you too. I got the initial answer from here For you, I first suppose the final calling of In
That's all :) In
The browserify-shim plugin treats Hope it will help you. |
When trying to transpile and bundle
.ts
file via Gulp/Browserify/Tsify the task fails with "Cannot find module" although standardtsc
transpilation works.I created an ambient module declaration based on TypeScript handbook:
And I'm trying to import it in another file:
The standard transpilation by TSC works ok:
tsc ./src/consumer.ts
But when trying to transpile with the use of Browserify/Tsify/Gulp the gulp task fails:
The error is:
Error: Cannot find module 'mymodule' from 'D:\Projects\Playground\TSTest\src'
I've put together a minimal repository which replicates the issue:
https://github.com/mnovotny/tsify-issue-250
The text was updated successfully, but these errors were encountered: