Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Add FAQ about loading audio files with Webpack #1256

Merged
merged 2 commits into from
Apr 30, 2019
Merged

Add FAQ about loading audio files with Webpack #1256

merged 2 commits into from
Apr 30, 2019

Conversation

mornir
Copy link
Contributor

@mornir mornir commented Mar 18, 2019

I hard a hard time finding how to achieve this in Nuxt 2.
Please correct me if this is not the optimal way πŸ™‡β€β™‚οΈ

I tried setting transformAssetUrls in the extend function. It did update the config, but I still couldn't import audio file with the src attribute.

export default {
  build: {
    extend (config, { isClient, loaders: { vue } }) {

      // This doesn't work for me.
      vue.transformAssetUrls.audio= 'src'

      config.module.rules.push({
        test: /\.(ogg|mp3|wav|mpe?g)$/i,
        loader: 'file-loader',
        options: {
          name: '[path][name].[ext]',
        },
      })
  
    }
  }
}

I hard a hard time finding how to achieve this in Nuxt 2.
Please correct me if this is not the optimal way πŸ™‡β€β™‚οΈ
@TheAlexLichter TheAlexLichter self-requested a review March 18, 2019 16:24
@atinux atinux requested review from TheAlexLichter and removed request for TheAlexLichter March 28, 2019 13:37
Copy link
Member

@TheAlexLichter TheAlexLichter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm the docs so far πŸ‘

IMO we should have that built-in though πŸ€”

@mornir
Copy link
Contributor Author

mornir commented Apr 27, 2019

Yes, it would be nice if the processing of audio files was already set up in the base Webpack config of Nuxt. (Even if loading audio files from the assets folder is much less common than for images.)

@atinux
Copy link
Member

atinux commented Apr 30, 2019

Thanks @mornir

I believe a module like @nuxtjs/audio could be even better honestly :)

@atinux atinux merged commit 4013e39 into nuxt:master Apr 30, 2019
haoqunjiang added a commit to haoqunjiang/component-compiler-utils that referenced this pull request Nov 4, 2019
haoqunjiang added a commit to vuejs/component-compiler-utils that referenced this pull request Dec 8, 2019
goldentroll added a commit to goldentroll/component-compiler-utils that referenced this pull request Mar 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants