-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
Use a relative path for the declaration assets #214
Use a relative path for the declaration assets #214
Conversation
Ah, this doesn't seem to be playing nicely with the |
Hi. Is there some news about this PR? |
@lbar: Nothing on my end, I'm holding off on working any further on it until someone more experienced lets me know if I'm going in the right direction :p |
OK thank you for your answer :) |
@jbrantly @johnnyreilly or any other maintainer, can you please look at this simple PR fixing #185, people are leaving to awesome-typescript-loader because of this issue, and I'd hate to join them! |
Okay - running the test just hangs on windows. Manually testing the PR does change the emit path but it also allows the test to run; this is a better outcome that at present in my book. I need to ponder this a bit. |
Okay - I've pondered it; I can't see any reason not to merge. @jbrantly if there's any objections then please do pitch in; it's a 1 line change and can easily be amended if there's abetter approach possible. But since this is not a working thing (at least on Windows) then I think it's probably worth going with this for now. Just as a by the by I put some
Do notice the difference in paths "/" vs "". Just didn't want to lose this information. |
@johnnyreilly Just as an aside, I've just ticked "Allow edits from maintainers" on this PR, so if you do need to make any changes you should have write access to my branch now! |
Okay merged. Now to try and get us back to a "passing tests" state 😄 |
This fix also gave us a broken change. d.ts files paths should be related to webpack context, not to current process workdir. They are not always equal. My webpack config looks like:
In 0.8.1 my asset name was |
Hi @dizel3d, Thanks for reporting; PRs to improve the behaviour would be gratefully received. Over to you 👍 |
@johnnyreilly, I did it, see PR #307 |
@dizel3d - Apologies for the breaking PR, this was my first one outside of updating docs and I wasn't too familiar with what the expected behavior was! Thanks for improving it <3 |
@17cupsofcoffee - don't let it frighten you off submitting more PRs! |
This is intended as a fix for issue #185 - a full explanation of what the problem was can be found in this comment, but what it boiled down to is that the language service returns absolute paths for generated declaration files, and these were being used directly as keys in
compilation.assets
, causing Webpack to hang during the emit stage. Resolving the path relative to the current working directory beforehand fixes this issue. According to @t246246's comment on the issue, this only affects Windows, but as I don't have access to a Linux or OSX device, I can't confirm that.One caveat to this fix is that the output file structure for the declaration files follows that of the source code - i.e, if the source looks like this:
Then the declarations get output like so:
This might well be a breaking change or not be the 'correct' way of handling it - I can't tell, as this functionality never worked for me in the first place! There's a currently pending pull request on awesome-typescript-loader's repository that demonstrates a possible way of making it follow Webpack's context instead - if the current way files are output isn't acceptable, I can have a go at implementing something along those lines here instead? Let me know, I can make some more changes if needed. This should be a good start though, at the very least.