How to use blueimp-file-upload with webpack?

前端 未结 9 1955
无人共我
无人共我 2021-02-05 08:46

I\'m using blueimp-file-upload in my website, and I\'m using webpack to organize my js code.

I installed blueimp-file-upload and jquery.ui.widget from NPM



        
9条回答
  •  囚心锁ツ
    2021-02-05 09:06

    jquery.fileupload.js checks for AMD require first which results in this error. You can teach webpack not to use AMD style for this file. (Make sure to npm install imports-loader for this method to work.):

    require('imports?define=>false!blueimp-file-upload')
    

    It should correctly register the module as CommonJS and will require the jquery.ui.widget from the right location.

    Read more here: http://webpack.github.io/docs/shimming-modules.html#disable-some-module-styles

提交回复
热议问题