-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
jest issue - read to end of issue; perhaps related to resolveTypeReferenceDirectives
addition?
#919
Comments
Anyone can take a look? |
I don't think anyone can as you haven't provided a minimal reproduction repo ... |
Sorry about that.. here is my package list in package.json file.
Here is my webpack.config.js
Here is my tsconfig.json:
Thanks!!! |
I am experiencing a similar issue with a recent upgrade from 5.3.3 to 5.4.3. As I build my project, I receive errors such as:
I had no issue previously. This is my tsconfig.json:
It seems to ignore the excluded folder If I exclude
A bit at a loss here. EDIT: I guess I could try and hammer it to silence, but I think it'd be better to properly fix this problem. EDIT2:
And while that silenced the error from
|
I have a similar problem after updating from 5.3.3 to 5.4.4 (5.4.3 has same problem): "TS2582: Cannot find name 'test'. Do you need to install type definitions for a test runner? Try I use jest, and jest itself runs fine. Webpack build fails. Downgrading only the ts-loader to 5.3.3 is my current workaround. My configs: webpack.config.js:
tsconfig.json
Edit: I took a look at the sources and the history. It seems like the PnP feature is the reason. But i can not see what happens there: ea2fcf9 Edit2: Link to the merge request is #921 |
I would lay good money that this comes down to the addition of https://github.com/TypeStrong/ts-loader/pull/921/files#diff-70b0dbb6219cb6164e67ffb54a8f23c0R157 If someone could take a look at this and advise if there's a genuine problem with the way this is implemented that would be helpful. It's difficult to take this further at the moment as we don't have a minimal reproduction repo to work with. Some assistance would be greatly appreciated; I'm fairly snowed right now ❤️ |
resolveTypeReferenceDirectives
addition?
Ran into the same problem today, upgrading from 5.3.3 to 5.4.4. |
One thing to notice is that it happens RANDOMLY and very rarely... |
Upgraded today from
Adding |
@johnnyreilly Here is a minimal testcase. It failes if you run |
I found a resolveTypeReferenceDirective: function(directive, containingFile, compilerOptions, moduleResolutionHost, original) {
return directive === "jest"
? { resolvedTypeReferenceDirective: { resolvedFileName: path.join(__dirname, "node_modules/@types/jest/index.d.ts") } }
: original(directive, containingFile, compilerOptions, moduleResolutionHost);
} |
Thanks for sharing the workaround @mijay If someone else could take a look at this I'd appreciate it - I'm fairly busy right now. Given the workaround just shared I suspect that any fix (should one be required) be applied to Line 506 in cc7b2b1
I'd suggest debugging the Though you may well be able to get what you need using However I haven't looked into this and others may know more than me 😄 As ever: PRs are welcome ❤️ |
resolveTypeReferenceDirectives
addition?resolveTypeReferenceDirectives
addition?
This is fixed in v6.0.1, which is building and publishing now. |
Awesome work @andrewbranch! |
Thanks to people involved |
Expected Behaviour
Build Successfully with no error
Actual Behaviour
I'm working with webpack + typescript + gulp, and loading .ts and .tsx files with ts-loader.
For most of the time, everything works fine.
But build RANDOMLY failed on ts2304 error or ts2345.
I found out that if I don't install types/jest (ts2304: cannot find describe ...etc.) and types/es6-shim (ts2345: something caused by promise I guess), I can always create the exact same build failure.
I added logs for npm install and ensured that the two types packages are installed successfully when build fails on this error.
So now I guess, it's probably caused by typescript not picking up those two typings? Or some ts-loader related issue?
Steps to Reproduce the Problem
I don't actually know how to reproduce it.
I already investigated on it for a month.... Really want to know what is happening here....
Many thanks!!!
Lois
The text was updated successfully, but these errors were encountered: