Case-Sensitive Paths Webpack Plugin

raw JSON →
2.4.0 verified Sat Apr 25 auth: no javascript

A Webpack plugin (current version 2.4.0) that enforces module path case sensitivity during builds, ensuring that the entire path of all required modules matches the exact case on disk. This helps prevent subtle bugs on case-insensitive filesystems (macOS, Windows) from causing failures on case-sensitive systems (Linux). Works with Webpack 3, 4, and 5. Releases are infrequent but stable, with minimal dependencies.

error Module not found: Error: [CaseSensitivePathsPlugin] `/path/to/file.js` does not match the corresponding path on disk `/path/to/File.js`
cause Import statement uses incorrect casing for the module path.
fix
Correct the casing of the import path to match the actual filesystem case.
error Cannot find module 'case-sensitive-paths-webpack-plugin'
cause Package not installed or not in devDependencies.
fix
Run npm install --save-dev case-sensitive-paths-webpack-plugin.
gotcha The plugin may cause slowdowns on large projects because it performs filesystem reads for each resolved module path.
fix Use `debug: false` to minimize overhead; consider disabling for production builds if not needed.
gotcha Works only with Webpack (not Vite, Rollup, etc.). Misleading if porting to other bundlers.
fix Use only in Webpack config. For other bundlers, find alternative or write a custom plugin.
npm install case-sensitive-paths-webpack-plugin
yarn add case-sensitive-paths-webpack-plugin
pnpm add case-sensitive-paths-webpack-plugin

Adds case-sensitive path enforcement to a Webpack configuration, catching mismatches during builds.

// webpack.config.js
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');

module.exports = {
  // ... other webpack config
  plugins: [
    new CaseSensitivePathsPlugin({
      debug: false // set to true for verbose logging
    })
  ]
};