Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

No files emitted with responsive-loader #99

Open
strarsis opened this issue Mar 1, 2020 · 3 comments · May be fixed by #109
Open

No files emitted with responsive-loader #99

strarsis opened this issue Mar 1, 2020 · 3 comments · May be fixed by #109

Comments

@strarsis
Copy link

strarsis commented Mar 1, 2020

  • Operating System: WSL 1 (Bash on Windows)
  • Node Version: v8.14.0
  • NPM Version: 6.14.1
  • webpack Version: 3.10.0
  • cache-loader Version: 4.1.0

Expected Behavior

Image files emitted by the responsive-loader should correctly cached or at least be written to disk.

Actual Behavior

All image files emitted by the responsive-loader are missing, they are not written as files to disk.

Code

// webpack.config.js
let webpackConfig = {
  module: {
    rules: [
      {
        test: /\.(jpe?g|png)$/i,
        use: [{
          loader: 'cache-loader',
        }, {
          loader: 'responsive-loader',
          options: {
            adapter: require('responsive-loader/sharp'),
            quality: 100, // (default)
            name: '[path][name]-[width].[ext]',
          },
        }],
      },
  [...]
}

How Do We Reproduce?

webpack setup with responsive-loader and cache-loader.
First leave the cache-loader disabled and let the responsive-loader resize some images (e.g. during CSS build). Notice that the resized images are correctly written to disk as files.
Now enable the cache-loader, run the build again. Notice that these files are not written to disk anymore, they are completely missing. Also inspect the cache folder and notice there are cache files for these resized images, but too small for an image file and they contain similar base64 encoded payload as above.

Additional notes

The cache files are very small for image files, the base64-decoded payload looks like this:

module.exports = {srcSet:__webpack_public_path__ + "images/layout/header-1557.jpg"+" 1557w",images:[{path:__webpack_public_path__ + "images/layout/header-1557.jpg",width:1557,height:743}],src:__webpack_public_path__ + "images/layout/header-1557.jpg",toString:function(){return __webpack_public_path__ + "images/layout/header-1557.jpg"},placeholder: undefined,width:1557,height:743};

No binary data of the actual image files can be found.

@alexander-akait
Copy link
Member

Problem still exists? Can you create reproducible test repo?

@strarsis
Copy link
Author

@evilebottnawi: Issue still exists, I can try to create a simplified, reproducible test case for this.

@alexander-akait
Copy link
Member

@strarsis will be great 👍

@mochiya98 mochiya98 linked a pull request Jul 28, 2020 that will close this issue
6 tasks
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 a pull request may close this issue.

2 participants