Serving mp3 files using the webpack file loader

后端 未结 5 531
名媛妹妹
名媛妹妹 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:31

    This is how I process mp3 files using Webpack in Nuxt 2:

      build: {
      
        loaders: {
          vue: {
            transformAssetUrls: {
              audio: 'src',
            },
          },
        },
    
        extend(config, ctx) {
          config.module.rules.push({
            test: /\.mp3$/,
            loader: 'file-loader',
            options: {
              name: '[path][name].[ext]',
            },
          })
        },
      },

    Now you can write in your templates and it should work.

提交回复
热议问题