带有 jest 和 webpack 的文件加载器给了我一个

Rue*_*gen 5 javascript webpack jestjs webpack-file-loader

我正在使用 ace 代码编辑器包,它在它的包中使用了一个 webpack-resolver.js 文件,该文件file-loader!在每个 require 语句中都有内联,例如

这适用于我的 webpack 配置,并且在使用它时一切都很好,但是当我去使用 jest 时,它无法识别文件加载器!并失败

require('file-loader!./src-noconflict/ext-beautify.js')
Run Code Online (Sandbox Code Playgroud)

jest 配置中有什么东西可以解决这个问题吗?

我收到以下错误

 Cannot find module 'file-loader!./src-noconflict/ext-beautify.js' from 'webpack-resolver.js'
Run Code Online (Sandbox Code Playgroud)

小智 6

我补充说:"ace-builds": "<rootDir>/node_modules/ace-builds"in Jest moduleNameMapper,它对我有用。