Ruegen
Ruegen

Reputation: 665

file-loader with jest and webpack gives me a

I am using ace code editor package which uses a webpack-resolver.js file in its package that has inline file-loader! in each require statement e.g.

This works fine for my webpack config and everything builds fine when using it however when I go to use jest, it isn't recognizing the file-loader! and fails

require('file-loader!./src-noconflict/ext-beautify.js')

Is there something in the jest config to fix this?

I get the following error

 Cannot find module 'file-loader!./src-noconflict/ext-beautify.js' from 'webpack-resolver.js'

Upvotes: 14

Views: 2526

Answers (1)

BlueGlideExcavator
BlueGlideExcavator

Reputation: 224

I added: "ace-builds": "<rootDir>/node_modules/ace-builds" in Jest moduleNameMapper, and it worked for me.

Upvotes: 16

Related Questions