-
-
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
Error when upgrading ts-loader #1638
Comments
What are the false-y values being passed that are triggering this? |
John thank you for the very quick response. falsey value is null. TLDR Sorry for the obtuse problem statement. I don't fully understand. I have a repo (I will publish the source in the next few weeks) that uses the create react template to generate a typescript project (so most of the code is a blackbox to me.) I did a yarn upgrade to ts-loader (and a few other packages) and I started getting an error. After several hours I figured out that ts-loader was throwing a null pointer exception because somehow the inputSourceMap is null (I honestly don't know where it's coming from but I suspect it's either from babel-loader or perhaps I have a tsconfig setting that is invalid?). This only happens with the ts-loader > 8.
The 'simple' solution (and maybe correct?) seemed to be to allow for the inputs to be falsy and not just check undefined. |
Sure, but are you able to confirm the nature of the false-y values that triggers this? It's the first time this has been reported. Also are you chaining loaders? |
The inputSourceMap value is null. I am not sure who is setting it. (I assume it's the babel loader as I am not deliberately) It is possible there is an issue in my config but I don't know where it could be. My question is should false-y values (or at least null) be supported as a valid inputtype? I would think so since you support undefined. |
Okay so I'm pretty sure the last release introduced the issue: #1626 I think |
Thanks John |
no worries - thanks for helping diagnose an issue! |
Fix should be released with https://github.com/TypeStrong/ts-loader/releases/tag/v9.5.1 |
I now get a null pointer exception
mappings: inputSourceMap.mappings,
This is because my prod build is not generating source maps and somehow the inputSourceMap is null (I am not setting it). The following code checks for undefined but not null.
If I change the following
https://github.com/TypeStrong/ts-loader/blob/9315855cd6f87883b137fc762da02f99a7842f46/src/index.ts#L152C3-L152C3
if (sourceMap === undefined || inputSourceMap === undefined) { callback(null, output, sourceMap); return; }
to
if (!sourceMap || !inputSourceMap) { callback(null, output, sourceMap); return; }
everything works as expected.
The text was updated successfully, but these errors were encountered: