electrode icon indicating copy to clipboard operation
electrode copied to clipboard

feat: Add local filesystem cache for webpack5 subapp

Open kylejeske opened this issue 3 months ago • 1 comments

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

kylejeske avatar Nov 20 '25 23:11 kylejeske

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.

CLAassistant avatar Nov 20 '25 23:11 CLAassistant