Giter VIP home page Giter VIP logo

Comments (12)

jerryOnlyZRJ avatar jerryOnlyZRJ commented on May 31, 2024 3

There is a hack for this issue:

You can put your cache-loader behind your mini-css-extract-plugin, like this:

{
    ...,
    {
        test: /\.(less|css)$/,
        use: [
          _mode === 'development' ? 'style-loader' : MiniCssExtractPlugin.loader,
          'cache-loader',
          {
            loader: 'css-loader',
            options: {
               importLoaders: 1,
               import: true,
             },
          },
          'postcss-loader',
        ],
      },
}

It seems to work well.

from cache-loader.

guylando avatar guylando commented on May 31, 2024 2

@evilebottnawi mini-css-extract could add caching ability as following: when receiving a module from previous loader, either cache-loader or css loader, then to hash the result in a way that can be compared for future builds. Similar to how other plugins implemented caching. Unless mini-css-extract actions are neglible time-wise, this will create a major performance improvement for mini-css-extract usage.

from cache-loader.

alexander-akait avatar alexander-akait commented on May 31, 2024

@guylando What? How it is related to extract? Please provide reproducible test repo

from cache-loader.

guylando avatar guylando commented on May 31, 2024

@evilebottnawi Here is the code to reproduce with steps to reproduce in the readme
https://github.com/guylando/WebpackCacheExtractCssBug

from cache-loader.

alexander-akait avatar alexander-akait commented on May 31, 2024

@guylando you use invalid configuration, cache-loader should be before fast-css-loader

from cache-loader.

guylando avatar guylando commented on May 31, 2024

@evilebottnawi I dont understand. The cache-loader appears before fast-css-loader in the array.
Can you please give example of the required fix?

from cache-loader.

guylando avatar guylando commented on May 31, 2024

@evilebottnawi Also would be helpful if you know where can I read the documentation about this (couldn't find information about this in google..)

from cache-loader.

guylando avatar guylando commented on May 31, 2024

Fixed by changing order between cache-loader and mini-css-extract loader but it kind of ruins the point of caching because mini-css-extract will exctract css each time even if cache is used.

from cache-loader.

guylando avatar guylando commented on May 31, 2024

So I still believe cache-loader and mini-css-extract dont work as desired when together.

from cache-loader.

alexander-akait avatar alexander-akait commented on May 31, 2024

@guylando cache-loader caching modules, extract css is not create modules and can't works by design

from cache-loader.

alexander-akait avatar alexander-akait commented on May 31, 2024

@guylando PR welcome

from cache-loader.

guylando avatar guylando commented on May 31, 2024

@jerryOnlyZRJ Read this: #40 (comment)

from cache-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.