I have written a WebPack Loader, mostly based on the instructions given in https://webpack.js.org/contribute/writing-a-loader/ .
Their way of testing the result is expect(output).toBe('export default "Hey Alice!\\n"'), which is hard to maintain, because it makes an assumption of the formatting of the source code generated by the loader.
To have more possibilities, I have tried to import the generated module via import("data:text/javascript;base64," + Buffer.from(output.toString("ascii"), "ascii").toString("base64")), which results in getting [Error: Cannot find module 'data:text/javascript;base64,...
Questions:
import can handle data URLs as source for modules?memfs (https://github.com/streamich/memfs)?P.S.: For the case it makes a difference, the loader and test case is implemented in typescript.