-
-
Notifications
You must be signed in to change notification settings - Fork 535
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
Could not find file .png #223
Comments
This can't be |
Wait, are you saying that this fixes it? Because the issue is obvious then. You've got |
I disabled the
This isn't the actual files, it's the require statements. But yes, overriding the There is a |
@oojacoboo Again, this is how |
Also, TypeScript is not trying to compile the asset. Node.js is trying to compile the asset. When in doubt, please run your code without TypeScript and you'll see the same result. Node.js doesn't typically enable arbitrary requires like that unless you add a "loader" (assuming you're coming from Webpack, no one else requires images except Webpack users 😛) like |
Sorry, that's doesn't seem to be accurate or correct. It seems pretty clear based on this error that TS is trying to compile the asset and throwing the errors as a result.
|
I tried my best to explain the issue to you. I've given you multiple steps and explained how you can re-produce it in node.js only. This is not a TypeScript or |
Now, if you update to the latest |
I'm actually really disappointed I merged this hack so the TypeScript compiler is skipped and will likely revert it at later date. I think the previous behaviour was the expected behaviour, you just didn't understand how node.js worked and wouldn't accept the explanation. If you're using |
@blakeembrey sorry for the frustration - not my intent. I do find this behavior quite frustrating. That said, I completely see what you're saying here. Thanks for explaining that in further detail. I wasn't aware of the Node.js fallback, although that makes perfect sense. I was under the impression that TS, through the This was discussed here: I do know I was able to compile with tsc without any errors. |
@oojacoboo Right. The behaviour works like this - TypeScript is the compiler and node is the runtime. Technically you're seeing the same behaviour in The In summary, the compilation and TypeScript is 100% correct based on what you told it. However, the runtime doesn't match up with what you told the compiler is true. I've reverted the PR I did above and tried an initial write-up in the README instead - see https://github.com/TypeStrong/ts-node#how-it-works. (Note that this sort of runtime/compiler mismatch is quite common - the most common example is adding |
Stumbled upon this old thread, having the same error when
where somefile.ts is a simple script to pre-process some resources. This references jpg files and I'm getting the error
Now I tried putting this at the very top of the file:
I'm happy with a workaround this is just a pre-processing script. However it doesn't solve the issue? Still same error |
Getting the following error when running ts-node. I haven't been able to resolve an issue surrounding asset requires with ts-node. However, it seems to be working properly with tsc and the proper definition types.
I thought it might be a typescript version issue at first, but I've confirmed that 2.1.0-dev is being used.
When enabling the
fast
prop for the register config, I then get hundreds of the following errors:Basically it seems it's trying to interpret the file as .js. I've tried defining the gif module as well like the following to no avail.
src/@types/images/index.d.ts
The only thing I can do to get it working is override the require.extensions assignment for each extension and silence it. Unfortunately, this is a pretty big hack IMO.
I'm not really sure what else to dig into here. Any thoughts?
The text was updated successfully, but these errors were encountered: