Giter Club home page Giter Club logo

Comments (9)

DotIN13 avatar DotIN13 commented on June 4, 2024 3

After doing a bit experiment, I figured that the deprecated cache-loader was substituted by the cache option, documented on Caching | webpackwebpack.js.org › guides › caching. The images cached will not be regenerated between builds.

I managed to lower my rebuild time from 160s to 0.4s with the following setting:

module.exports = {
  ...
   cache: {
        type: "filesystem",
        cacheDirectory: path.resolve(__dirname, '.webpack-cache'),
    }
}

from responsive-loader.

jstcki avatar jstcki commented on June 4, 2024 1

I haven't tried but I think it makes sense.

from responsive-loader.

daniel100097 avatar daniel100097 commented on June 4, 2024 1
{
    test: /\.(jpe?g|png)$/i,
    use: [{
        loader: "cache-loader",
    }, {
        loader: "url-loader",
        options: {
            adapter: require("responsive-loader/jimp"),
            fallback: "responsive-loader",
            limit: 8192,
            sizes: isProd() ? [720, 1024, 1920] : [1920],
            format: "png",
        },
    }],

}

from responsive-loader.

strarsis avatar strarsis commented on June 4, 2024

@daniel100097: Thanks, but when I try that config no resized image files are emitted anymore.
sharp is used instead of jimp in this setup, maybe this causes the issue?

from responsive-loader.

strarsis avatar strarsis commented on June 4, 2024

@DotIN13: Awesome! Thanks.

from responsive-loader.

slorber avatar slorber commented on June 4, 2024

@DotIN13 are the resized images cached in the node_modules/.cache/webpack folder too as a .pack file?

from responsive-loader.

DotIN13 avatar DotIN13 commented on June 4, 2024

@DotIN13 are the resized images cached in the node_modules/.cache/webpack folder too as a .pack file?

As I see it, the cache config I posted does not involve a node_modules/.cache directory. Looks like the cache generated were all stored in .webpack-cache dir.

from responsive-loader.

slorber avatar slorber commented on June 4, 2024

@DotIN13 it's the default cache location.

Do to reword my question: do you see images in .webpack-cache? Or do you fthink images are in a pack file?

from responsive-loader.

DotIN13 avatar DotIN13 commented on June 4, 2024

@DotIN13 it's the default cache location.

Do to reword my question: do you see images in .webpack-cache? Or do you fthink images are in a pack file?

Okay, yes, image caches were bundled in .pack files by webpack. And as webpack isn't regenerating any new images during rebuilds, I suppose that the resized images were included in those .pack files.

from responsive-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.