Vite allows to import files as raw strings using
import foo from "foo.txt?raw"
However, jest complains that it cannot find the file. I found the jest-raw-loader, but I don't know how to tell it to apply raw loading to the "?raw" syntax.
Vite allows to import files as raw strings using
import foo from "foo.txt?raw"
However, jest complains that it cannot find the file. I found the jest-raw-loader, but I don't know how to tell it to apply raw loading to the "?raw" syntax.
I added the following to moduleNameMapper it worked.
"moduleNameMapper": {
".*\\.txt\\?raw": "jest-raw-loader"
}