In TypeScript, there is a technique by which one can import
an image as a string
.
import
the image file in TypeScript source code,
import spinner from 'assets/loading_spinner@2x.png';
and then in the .js
produced by the tsc
compiler, there will be a line like
var spinner = "data:image/png;base64,iVBORw0KGgoAAA.....";
How could we accomplish the same thing in PureScript? The usual foreign module technique won't work, because it's the tsc
compiler which does this “image import.”
References
https://www.typescriptlang.org/docs/handbook/release-notes/overview.html#untyped-imports
https://webpack.js.org/guides/typescript/#importing-other-assets