-
-
Notifications
You must be signed in to change notification settings - Fork 247
Fix bug where compiler is not accessible by computeContextPath #299
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
Conversation
Awesome work! Would you be able to add a test as well so we don't regress this in future please? (I've an idea we've broken this previously 😭) |
Well, the thing is, I have no idea how to reproduce the problem in an isolated test. I mean, the existing tests don't break, so I'm really not sure about the cause of this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind - let's get this anyways 😄
I'd ❤️ to merge this but it doesn't meet our commit guidelines: https://github.com/Realytics/fork-ts-checker-webpack-plugin/blob/master/CONTRIBUTING.md#examples We're using semantic-release - can you fix up using this convention instead please? |
Sure, done. |
Not questioning this PR, (let's merge it as soon as the CI is through), but out of general curiousity, because I would love to understand the underlying problem: What is your setup? Are you also using grunt-webpack like in #267? |
@phryneas No, as I wrote above, I am using serverless with serverless-webpack and individual packaging enabled. |
Oh, sorry, somehow overread that :) Thanks 👍 So it seems this happens with multi-webpack setups. |
🎉 This PR is included in version 1.3.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
So what I believe happens is this:
|
Wow, that actually makes sense. Good find! |
@phryneas Any idea if a test for that can be written? |
@DASPRiD Phew... I guess it can, at least partially. Short analysis: this type of bug can only occur in the index.ts, in the class Instantiating the plugin, deepCloning it and then just calling all methods won't do the trick though (as all these methods are highly interconnected) - and especially it will most likely not catch any new bugs introduced in the future. The only thing I would see here is to create an integration test and in the prepareWebpackConfig callback of the createCompiler helper replace the plugin with a deepCloned copy. Then just run the plugin and see if it works or fails. Something like this test could be a starting point, with the modifications I described above. Would you be willing to give it a try? :) |
@phryneas uff, I'm not too much into all the guts of webpack or this plugin, so I'd rather leave that to you, as you seem to definitely have a better understanding of this :) |
Once again I'm astounded by @phryneas ability to find, diagnose and understand an esotoric problem in the codebase... And not only that he documents it effectively thus communicating what he's learned to anyone that cares to read. Props! |
@DASPRiD Feared so ^^. |
I am still having some trouble with this. Sometimes,
The problem is fixed when I add a |
@madebyherzblut you're absolutely right, that's a follow-up error that now occurs because that method is not implicitly bound any more sigh |
While I was at it writing a regression test für #300, I added one for this ticket, too :) |
I'm not 100% certain why this was causing a problem. I did some debugging and it turned out that computeContextPath as an arrow function had not the same
this
context. When changing it to a normal function, it works as expected.Fixes #267
For me this bug was happening in conjunction with serverless-webpack and having individual packaging enabled.