Serving mp3 files using the webpack file loader

后端 未结 5 545
名媛妹妹
名媛妹妹 2020-12-31 01:57

I have a problem with getting my mp3 files to work using the webpack file loader.

This is the issue:

I have a mp3 file on my harddisk, that if I open using c

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-31 02:30

    Check the version of the file-loader, I solved this by upgrading the file-loader from 4.x.x to 6.x.x, then add mp3 to the normal webpack config plugin settings for files =>

    // webpack.config.js
    
          { 
            test: /\.(gif|png|jpe?g|svg|xml|mp3)?$/i,
            use: "file-loader"
          }
          // OR
          {
            test: /\(mp3|wav|mpe?g|ogg)?$/i,
            use: 'file-loader'
          }
          
          // OR BOTH

提交回复
热议问题