question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't seem to work with responsive loader

See original GitHub issue

This is my config file

const ImageminPlugin = require('imagemin-webpack').ImageminWebpackPlugin;
const responsiveSharp = require('responsive-loader/sharp');
const ImageminWebp = require('imagemin-webp');

const config = {
    entry: './src/index.js',
    output: {
        
        filename: '[name].js',
        pathinfo: false
    },
    module: {
        rules: [
            {
                test: /\.(css)$/,
                use: [
                    {
                        loader: 'style-loader',
                    },
                    {
                        loader: "css-loader", // creates style nodes from JS strings
                    }
                ]
            },
            {
                test: /\.(png|jpe?g|svg|bmp|gif|webp)$/,
                use: [
                    {
                        loader: 'url-loader',
                        options: {
                            limit: 10000,
                            name: 'images/[name].[hash].[ext]',
                            fallback: 'responsive-loader',
                            adapter: responsiveSharp
                        }
                    }
                ]
            }
        ]
    },
    plugins: [
        
    ],
}

const imagemin2 = new ImageminPlugin({
    // name: 'imagemin/[name].[hash].webp',
    imageminOptions: {
        plugins: [
            ImageminWebp({
                loseless: true
            })
        ]
    }
});

// config.plugins.push(imagemin);
config.plugins.push(imagemin2);
module.exports =  config;

Add/removing this plugin with responsive-loader doesn’t seem to effect image size in any way however if I disable responsive-loader and enable this it does produce minified image.

I am expecting it to minify images that go through responsive loader.

This is my package.json

"devDependencies": {
    "css-loader": "^1.0.0",
    "file-loader": "^2.0.0",
    "imagemin-gifsicle": "^5.2.0",
    "imagemin-jpegtran": "^5.0.2",
    "imagemin-mozjpeg": "^7.0.0",
    "imagemin-optipng": "^5.2.1",
    "imagemin-svgo": "^7.0.0",
    "imagemin-webp": "^4.1.0",
    "imagemin-webpack": "^3.0.0",
    "responsive-loader": "^1.1.0",
    "sharp": "^0.21.0",
    "style-loader": "^0.23.1",
    "url-loader": "^1.1.2",
    "webpack": "^4.26.1",
    "webpack-cli": "^3.1.2",
    "webpack-dev-server": "^3.1.10"
  },

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
talha5389commented, Dec 3, 2018

@evilebottnawi Sure. I will do that when I found time today or tomorrow

0reactions
alexander-akaitcommented, Jan 23, 2019

Done in master, release will be in near future

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading animation is not responsive - javascript - Stack Overflow
1 Answer 1 ... You didn't include your styles for your preload overlay, but, if it is an option, flexbox is your best...
Read more >
A webpack loader for responsive images - GitHub
A webpack loader for responsive images. Creates multiple images from one source image, and returns a srcset . For more information on how...
Read more >
Hestia does not offer responsive images, even with Optimole
Optimole, the solution advertised for response images, does not seem to work with the slide images used in the Big Title section. These...
Read more >
Lazy-load doesn't support Responsive image formatter - Drupal
Hi, I am using the D8 version of Lazy. It does not give any performance boost. I can see that the tag 'b-lazy'...
Read more >
Preloading responsive images - web.dev
Learn about new and exciting possibilities for preloading responsive images to ensure great user experience.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found