Description
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.
Error: Could not find file: '/valid/path/to/actual/file/image.png'. at getValidSourceFile (~/node_modules/typescript/lib/typescript.js:73826:23)
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:
/valid/path/to/actual/file/image.png (38,64): Invalid character. (1127)
/valid/path/to/actual/file/image.png (38,64): Argument expression expected. (1135)
/valid/path/to/actual/file/image.png (38,64): Unterminated string literal. (1002)
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
declare module '*.png' {
const png: any;
export default png;
}
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?