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'
They allow you to pre-process files as you import or “load” them. Thus, loaders are kind of like “tasks” in other build tools and provide a powerful way to handle front-end build steps. Loaders can transform files from a different language (like TypeScript) to JavaScript or load inline images as data URLs.
Jest can be used in projects that use webpack to manage assets, styles, and compilation.
I added: "ace-builds": "<rootDir>/node_modules/ace-builds"
in Jest
moduleNameMapper
, and it worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With