Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda