How to use blueimp-file-upload with webpack?

前端 未结 9 1954
无人共我
无人共我 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:00

    Disable both AMD and CommonJS and use the Browser Global jQuery.

    /* The jQuery UI widget factory, can be omitted if jQuery UI is already included */
    require('imports?define=>false&exports=>false!blueimp-file-upload/js/vendor/jquery.ui.widget.js');
    /* The Iframe Transport is required for browsers without support for XHR file uploads */
    require('imports?define=>false&exports=>false!blueimp-file-upload/js/jquery.iframe-transport.js');
    /* The basic File Upload plugin */
    require('imports?define=>false&exports=>false!blueimp-file-upload/js/jquery.fileupload.js');
    /* The File Upload processing plugin */
    require('imports?define=>false&exports=>false!blueimp-file-upload/js/jquery.fileupload-process.js');
    /* The File Upload validation plugin */
    require('imports?define=>false&exports=>false!blueimp-file-upload/js/jquery.fileupload-validate.js');
    /* The File Upload Angular JS module */
    require('imports?define=>false&exports=>false!blueimp-file-upload/js/jquery.fileupload-angular.js');
    

    This is the configuration I'm using to integrate webpack, blueimp-fileupload with angular. Alternatively you can configure in your webpack.config.js as a regex to avoid repeating loaders.

提交回复
热议问题