How to use blueimp-file-upload with webpack?

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

    first install two plugins

    npm i blueimp-file-upload --save
    npm i jquery-ui --save
    

    then require in web pack

    require('blueimp-file-upload/js/jquery.fileupload')
    
    0 讨论(0)
  • 2021-02-05 09:13

    In webpack 3.x, the syntax will look like this:

      {
        test: require.resolve("blueimp-file-upload"),
        use: "imports-loader?define=>false"
      }
    
    0 讨论(0)
  • 2021-02-05 09:14

    You can add an alias to jquery.ui.widget's main file - it unfortunately doesn't specify one in its package.json, so webpack can't find it otherwise.

    resolve: {
        alias: {
            "jquery.ui.widget": "node_modules/jquery.ui.widget/jquery.ui.widget.js"
        }
    },
    
    0 讨论(0)
提交回复
热议问题