Socket
Socket
Sign inDemoInstall

cache-loader

Package Overview
Dependencies
Maintainers
9
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-loader

Caches the result of following loaders on disk.


Version published
Weekly downloads
787K
decreased by-1.33%
Maintainers
9
Weekly downloads
 
Created

What is cache-loader?

The cache-loader package is used to speed up the build process by caching the results of expensive loaders in webpack. This can significantly reduce build times by avoiding redundant processing.

What are cache-loader's main functionalities?

Caching Loader Results

This feature allows you to cache the results of loaders like babel-loader. By using cache-loader before babel-loader, the results of babel-loader are cached, which can significantly speed up subsequent builds.

const path = require('path');

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

Custom Cache Directory

This feature allows you to specify a custom directory for the cache. This can be useful if you want to control where the cache files are stored, for example, to avoid conflicts or to place them in a directory that is not cleaned up by other processes.

const path = require('path');

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

Other packages similar to cache-loader

Keywords

FAQs

Package last updated on 13 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc