How to use jest with webpack?

前端 未结 12 2607
抹茶落季
抹茶落季 2020-12-08 06:00

I use webpack to develop a React component. Here is a simple version of it:

\'use strict\';

require(\'./MyComponent.less\');

var React = require(\'react\')         


        
12条回答
  •  清歌不尽
    2020-12-08 06:45

    We had a similar problem with CSS files. As you mentioned before jest-webpack solves this problem fine. You won't have to mock or use any module mappers either. For us we replaced our npm test command from jest to jest-webpack and it just worked.

提交回复
热议问题