-
Notifications
You must be signed in to change notification settings - Fork 181
Cannot find external module #4
Comments
@EliotVU could you please give some small example to reproduce? I haven't checked the case like that with traceur, so I need to take a look. |
Ok so my project was originally using RequireJS and Traceur and a few Typescript files where using static typing made sense such as clientItem.ts. That setup worked fine but I decided to use Webpack for its bundling given that requirejs wasn't very good at it and also rather slow. Now after porting to to Webpack + traceur + typescript and your loader the above issue arises. So the current setup is: Entry -> main.js -> loads some files which in turn load the clientItem.ts as follows:
at this point clientTag itself fails to find its own Typescript imports, and this class's imports look like:
Anything else? Perhaps mixing the two just isn't doable? |
Ok I have made a new minimal project for the sake of demonstrating this issue, you can download it at www.eliotvu.com/files/lab.rar install it using "npm install" and run it with "gulp". I had hoped making this little separation might have revealed the problem or a mistake but unfortunately it still cannot find any imports from within .ts files. |
@EliotVU thank you for your example. Now I know what is wrong with the loader. I'll try to fix this ASAP. |
@EliotVU fixed in v0.2.3, please confirm |
This fixes the lab example but in the actual non minimal app a new issue occurs where I have multiple typescript files importing the same file and this leads to a new problem where the loader tries to load for example item.ts from another .ts file whom doesn't import it and thus the path also breaks as that .ts file is in a subfolder.
Content of status.ts:
status.ts should not be trying to import ./shared/item at all. |
To add to that: I have clientItem.ts and clientTag.ts, with the new fix clientItem.ts works and manages to import all the other .ts files except for clientTag.ts which imports the same modules as clientItem.ts, which looks like this:
Seems to me the loader is having issues with importing the same module multiple times?
|
Updated the lab example to demonstrate this issue, www.eliotvu.com/files/lab2.rar |
@EliotVU thanks again! I've found an error with two (or more) root TS files as in your case. Please try v0.2.4 |
New error:
Content of status.ts
|
@EliotVU I don't think that it's loader error, because the code you published is not a valid TypeScript. It must show you errors like:
It does it in my case. Could you please publish one more example with your error? |
Ah good point, I forgot I'm using invalid typescript for that one file, which actually does work regardless of the error, it is more like a warning even if it may be marked as an error. I believe the issue here with the loader is that it probably denies the file if an error occurred? Where as ordinary Typescript will just throw an error but still continue with building the .js file and thus work regardless. p.s. assigning a string to an enum is supposed to be supported in a later file so I kept it. So could you make it so it continues building regardless? |
@EliotVU yes, I think I can. But I can't repeat setup when errors about StatusCode don't appear. If you don't see the errors — please send me the code so I can repeat this. I'll implement "emit anyway" stuff. |
I added the status.ts to "lab" but I get the same error as yours so no need to reupload. That said I don't get it in the main project where it just says "no output found for ...", no clue why it doesn't mention the error first. |
In lab.rar (the last one you got from me) this error also happens to appear on very random occasions: I also figured even when successful there is no app.bundle.js in /dist/ ever. |
Oh the /dist/ is empty cause I forgot I'm using gulp-webpack without gulp pipes 📦 |
Alright after some debugging and editing your code I noticed an odd issue that might be the cause of all this: When trying this code in main.js:
Status.module: not empty Now if I compile the main.js in this require order:
Status.module: empty Where empty means no text at all. Uh? |
I fixed this by rewriting your flow code at index.js:
What fixes it are the resetService and resetProgram calls, though this only good as a temporary fix because this causes it to recompile all .ts files for each .ts files but at least it ain't no more skipping some random files lol? Example Log: compiling file c:\wamp\www\lab\src\classes\client-tag.ts status.ts is not even imported by client-tag.ts but still written, |
@EliotVU just a status update. Right now I can't understand what is wrong, it looks like TS compiler error or something like that. The workaround is to use one root entry TS file. I'll continue working on that problem during the next weekend. |
Alright thanks, looking out for the fix! Currently compiling the Typescript files takes about 5-7 seconds with this reset "hack". |
|
@EliotVU, sorry, the right version is |
Thanks, it appears to have been fixed. Well except for the module not found error, but that has already been reported. Thanks for your time! |
Given this directory structure:
And importing clientItem from main.js(traceured, not typescripted), leads to:
Any idea why it cannot find the module even though it is obviously right there?
This is the webpack configuration:
Now that said, compiling those .ts files work as expected when compiling it without using any Webpack loaders.
The text was updated successfully, but these errors were encountered: