Jquery.mockjax using webpack requiring padding

Has anyone used mockjax to test jasmine blocks with webpack? I keep getting $ .mockjax undefined. It has something to do with

//NOTE. To use Mockjax as a Node module, you MUST provide factory // a valid version of jQuery and a window object (global scope): // var mockjax = require ('jquery.mockjax') (jQuery, window);

but I cannot use require in the AMD module. I tried using padding and import loader using webpack, but I might have done something wrong because I do not quite understand the problem.

+4
source share
1 answer

This is pretty old, but I missed it due to the lack of a tag mockjax! In any case, this should have been allowed in PR # 284 . There was a question about this with some suggestions , in particular:

{
    test: require.resolve('jquery-mockjax/dist/jquery.mockjax.js'),
    use: ['imports-loader?this=>window,exports=>""']
}
0
source

Source: https://habr.com/ru/post/1657310/


All Articles