Skip to content
Discussion options

You must be logged in to vote

Hi @khan03148. You can load audio files like this in your next.config.js:

npm install file-loader url-loader --save-dev

module.exports = {
  webpack(config, options) {
    const { isServer } = options;
    config.module.rules.push({
      test: /\.(ogg|mp3|wav|mpe?g)$/i,
      exclude: config.exclude,
      use: [
        {
          loader: require.resolve('url-loader'),
          options: {
            limit: config.inlineImageLimit,
            fallback: require.resolve('file-loader'),
            publicPath: `${config.assetPrefix}/_next/static/images/`,
            outputPath: `${isServer ? '../' : ''}static/images/`,
            name: '[name]-[hash].[ext]',
            esModule: config.

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@khan03148
Comment options

@khan03148
Comment options

@jamesmosier
Comment options

@bgryks18
Comment options

Answer selected by jamesmosier
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants