React Nextjs: Module parse failed:You may need an appropriate loader to handle this file type,currently no loaders are configured to process this file

Solution 1:

If you are using Webpack4, it appears you want the raw-loader

https://v4.webpack.js.org/loaders/raw-loader/

{
  test: /\.pdf$/i,
  use: 'raw-loader',
}

If you are using Webpack5, the new Asset Modules are available:

https://webpack.js.org/guides/asset-modules/

(raw-loader replacement)

{
  test: /\.pdf$/i
  type: 'asset/source'
}

(file-loader replacement)

{
  test: /\.pdf$/i
  type: 'asset/resource',
  generator: {
    filename: `[name][ext]`
  }
}