dazuaz / responsive-loader

A webpack loader for responsive images
BSD 3-Clause "New" or "Revised" License
647 stars 74 forks source link

[FEATURE REQUEST] How to configure for auto publicPath? #159

Closed webdiscus closed 2 years ago

webdiscus commented 2 years ago

Using Webpack auto publicPath the image output filename is wrong.

module.exports = {
  output: {
    path: path.resolve(__dirname, 'dist'),
    publicPath: 'auto',
  },
  module: {
    rules: [
      {
        test: /\.(png|jpe?g)$/i,
        type: 'asset/resource',
        loader: 'responsive-loader',
        options: {
          //publicPath: 'auto', // <-- What value should be here when used auto publicPath?
          name: 'assets/img/[name].[hash:8]-[width]w.[ext]',
        },
      },
    ],
  },
}