Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda