Skip to content

Conversation

@kylejeske
Copy link
Member

Simple helper function for configuring webpack 5 filesystem cache with sensible defaults.

Features:

  • Zero-config setup with createFilesystemCacheConfig(__filename)
  • Automatic cache invalidation when webpack config changes
  • Customizable cache directory, name, and version
  • TypeScript support with full type definitions
  • Framework-agnostic (works with any webpack 5 setup)

Usage:

// webpack.config.js

const { createFilesystemCacheConfig } = require('@xarc/webpack-devcache-config');

// other xarc/app-dev includes
const {
  initWebpackConfigComposer,
  compose,
  getComposeOptions,
} = require("@xarc/app-dev/config/webpack");

const options = getComposeOptions();
const { composer, ...opts } = initWebpackConfigComposer(options);

// other webpack config settings/options

const finalConfig = compose({ composer, ...opts });

// Enable filesystem cache for subapps
const isDev = process.env.NODE_ENV !== 'production';
if (isDev) {
  finalConfig.cache = createFilesystemCacheConfig(__filename);
  console.log('✅ [WEBPACK CACHE] Filesystem cache enabled with SubApp serialization support!');
}

Benefits:

  • Reduces boilerplate for webpack cache configuration
  • Ensures consistent cache setup across projects
  • Works seamlessly with @xarc/webpack SubApp serialization support

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants