Is there a way of importing an asset in React-Native dynamically with import(...)
instead of require(...)
?
We are using @typescript-eslint/recommended
and I'd like to keep the rule @typescript-eslint/no-var-requires
enabled, which is marking this as an error.
The way we do it now:
const foo = require("../path/to/foo.png")
How I want to do it:
const foo = import("../path/to/foo.png")
It would also be ok if I could just use normal ESM import syntax rather than require. Is there any way?