Skip to content

alexander-akait/cache-loader

 
 

Repository files navigation

npm deps test coverage chat

cache-loader

Caches the result of following loaders on disk.

Install

npm install --save-dev cache-loader

Usage

Add this loader in front of other (expensive) loaders to cache the result on disk.

Note that there is an overhead for saving the reading and saving the cache file, so only use this loader to cache expensive loaders.

Examples

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.js$/,
        include: path.resolve("src"),
        use: [
          "cache-loader",
          "babel-loader"
        ]
      }
    ]
  }
}

with options

use: [
  {
    loader: "cache-loader",
    options: {
      // provide a cache directory where cache items should be stored
      cacheDirectory: path.resolve(".cache")
    }
  },
  "babel-loader"
]

Maintainers


sokra

About

Caches the result of following loaders on disk.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%