Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
How to test a webpack loader with Jest?

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:

  • Is there something I have to do additionally, that import can handle data URLs as source for modules?
  • Is there an alternative way to import a module from a memfs (https://github.com/streamich/memfs)?

P.S.: For the case it makes a difference, the loader and test case is implemented in typescript.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!