Giter VIP home page Giter VIP logo

case-sensitive-paths-webpack-plugin's Introduction

Case Sensitive Paths - Webpack Plugin

Build Status Known Vulnerabilities npm version npm downloads bananas: ripe FOSSA Status

This Webpack plugin enforces the entire path of all required modules match the exact case of the actual path on disk. Using this plugin helps alleviate cases where developers working on OSX, which does not follow strict path case sensitivity, will cause conflicts with other developers or build boxes running other operating systems which require correctly cased paths.

Previous iterations on this same idea provide the basis for this plugin, but unfortunately do not properly check case on the entire path. This plugin fixes that. Example output:

ERROR in ./src/containers/SearchProducts.js Module not found: Error: [CaseSensitivePathsPlugin] /Users/example/yourproject/src/components/searchProducts/searchproducts.js does not match the corresponding path on disk /Users/example/yourproject/src/components/searchproducts @ ./src/containers/SearchProducts.js 9:22-84

Install

npm install --save-dev case-sensitive-paths-webpack-plugin

Usage

var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');

var webpackConfig = {
    plugins: [
        new CaseSensitivePathsPlugin()
        // other plugins ...
    ]
    // other webpack config ...
}

Want more information? Pass {debug: true} to the plugin like so:

new CaseSensitivePathsPlugin({debug: true})

It will output every directory it reads, as well as a sum total of filesystem operations. This is mostly useful for internal debugging of the plugin, but if you find it useful, more power to you.

Demo

Check the /demo directory for a working example of the plugin in action, with tests demonstrating the effect of the plugin. See /demo/README.md for more.

Thanks & Credit

License

FOSSA Status

case-sensitive-paths-webpack-plugin's People

Contributors

aggieben avatar dependabot[bot] avatar fossabot avatar gustaff-weldon avatar ivasilov avatar jkimbo avatar jquense avatar kirill-konshin avatar maadhattah avatar simonkberg avatar sunilbandla avatar urthen avatar wtgtybhertgeghgtwtg avatar wuct avatar xml avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

case-sensitive-paths-webpack-plugin's Issues

Question: Will this work for typescript?

Hey just wondering if this works for typescript? I've installed and run but can only see output ~ Reading Directory ...
Seems to be node_module folders and not hitting my src directory.

Having some issues because I develop on windows and build on linux.

Thanks.

I want to make it case-insensetive

Hey all,
I am working with a team all of them use windows machine but I use fedora , when I start to clone the project everything is working well in their machines but after i have run npm start there is many errors like this

ERROR in ./router.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./features/patientGrid/index in /myRepoInFedoraMachine
Do you have any suggestions ?

Breaks with npm link

I npm linked a library that I'm developing into a fresh create-react-app'd project, and it worked perfectly fine.

Then I changed something in the library, which meant it would delete the lib/ folder and recompile all the files.

No matter how long I waited CaseSensitiveWebpackPlugin always threw this error, even when the file long exists again! I have to restart the server for every tiny library change, which is specifically something I tried to avoid.

Module not found: [CaseSensitivePathsPlugin] `/Users/something/sites/somelib/styled-components/lib/index.js` does not match the corresponding path on disk - File does not exist.

/cc @gaearon so he's aware since this breaks in create-react-app, might be issues over there too.

Error when new file is created

When I create a new file while the server is running, and modify another one to refer to it, the plugin thinks the file doesn't exist and throws an error.

I have a test case to reproduce it, posting it in a few hours.

Non-issue causing warnings in Windows

This plugin is great for finding those errors, but it also triggers on different cases in parent directories on Windows that don't affect the actual build. For instance I might have a C:\Git\My-Project folder, but in development I might cd \git\my-project. Something in a build for 'create-react-app' is causing this because some modules are loaded with an absolute path (including '~' inside). It would be nice if it could ignore directories outside the root of the project.

Question: Use with create-react-app without ejecting? Possible?

As far as I can tell, this doesn't seem to be possible, since the webpack config files are not exposed in create-react-app (so you can't register plugins). Maybe this is a stupid question, but is there maybe a webpack-independent implementation that you know of? If not, is it possible (easy?) to modify your code to be webpack independent? I guess the tricky part would be to extract all the file-paths from the project code base?

Thankful for any help or pointers! And thanks for developing and maintaining this plugin! I've used the plugin before (on a project where we weren't so afraid to eject) and it's great!

Error: does not match the corresponding path on disk

Hi,
I would really appreciate your help or guidance on this issue.
This plugin is being used internally by gridsome in the build process, now it runs fine on my local setup but I then did a setup of GitHub actions to deploy the website on push then this plugin started giving out this error.

Action logs:

yarn run v1.22.10
$ gridsome build
Gridsome v0.7.23

Initializing plugins...
Load sources - 0.07s
Create GraphQL schema - 0.2s
Create pages and templates - 0.1s
Generate temporary code - 0.01s
Bootstrap finish - 2.13s
Compiling assets...
Error: [CaseSensitivePathsPlugin] `D:\a\opendevs-webpage\opendevs-webpage\src\pages\portfolio\[username].vue` does not match the corresponding path on disk `Portfolio`.
    at D:\a\opendevs-webpage\opendevs-webpage\node_modules\case-sensitive-paths-webpack-plugin\index.js:153:16
    at D:\a\opendevs-webpage\opendevs-webpage\node_modules\case-sensitive-paths-webpack-plugin\index.js:113:7
    at D:\a\opendevs-webpage\opendevs-webpage\node_modules\case-sensitive-paths-webpack-plugin\index.js:101:7
    at CaseSensitivePathsPlugin.getFilenamesInDir (D:\a\opendevs-webpage\opendevs-webpage\node_modules\case-sensitive-paths-webpack-plugin\index.js:51:5)
    at CaseSensitivePathsPlugin.fileExistsWithCase (D:\a\opendevs-webpage\opendevs-webpage\node_modules\case-sensitive-paths-webpack-plugin\index.js:89:8)
    at D:\a\opendevs-webpage\opendevs-webpage\node_modules\case-sensitive-paths-webpack-plugin\index.js:106:10
    at Array.<anonymous> (D:\a\opendevs-webpage\opendevs-webpage\node_modules\case-sensitive-paths-webpack-plugin\index.js:67:5)
    at Storage.finished (D:\a\opendevs-webpage\opendevs-webpage\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\a\opendevs-webpage\opendevs-webpage\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
    at D:\a\opendevs-webpage\opendevs-webpage\node_modules\enhanced-resolve\lib\NodeJsInputFileSystem.js:12:4
    at go$readdir$cb (D:\a\opendevs-webpage\opendevs-webpage\node_modules\graceful-fs\graceful-fs.js:214:14)
    at FSReqCallback.oncomplete (fs.js:171:23)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

Action file: https://github.com/open-devs/opendevs-webpage/blob/master/.github/workflows/gh-pages.yml

Please help, really can't wrap my head around this, I even used path.resolve but that didn't fix it.

"File does not exist" is confusing

When I switch between branches, I often see messages like this:

Module not found: [CaseSensitivePathsPlugin] /Users/dan/p/create-react-app/packages/react-scripts/template/src/service-worker-registration.js does not match the corresponding path on disk - File does not exist.

Note how it starts with the case sensitive plugin intro, but then the real issue is that the file just stopped existing. So the message is misleading until the very last four words.

Shouldn't the plugin just bail out if a file was deleted, and ignore it? Then webpack can show its normal message about file missing.

get errors on windows

I just had errors on windows when i run the demo.

WARNING in ./~/.npminstall/react/15.2.1/react/lib/traverseAllChildren.js
There is another module with an equal name when case is ignored.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Rename module if multiple modules are expected or use equal casing if one module is expected.

WARNING in E:/case-sensitive-paths-webpack-plugin/demo/~/.npminstall/react/15.2.1/react/lib/traverseAllChildren.js
There is another module with an equal name when case is ignored.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Rename module if multiple modules are expected or use equal casing if one module is expected.

WARNING in ./~/.npminstall/react/15.2.1/react/lib/getIteratorFn.js
There is another module with an equal name when case is ignored.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Rename module if multiple modules are expected or use equal casing if one module is expected.

WARNING in E:/case-sensitive-paths-webpack-plugin/demo/~/.npminstall/react/15.2.1/react/lib/getIteratorFn.js
There is another module with an equal name when case is ignored.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Rename module if multiple modules are expected or use equal casing if one module is expected.

Please help me.

Avoid calling readdir() on same path multiple times

Recently I'm diagnosing build time on my project. I found case-sensitive-paths-webpack-plugin costs significant time (with speed-measure-webpack-plugin).

On a build with 4000+ modules.

CaseSensitivePathsPlugin took 3 mins, 47.68 secs
[CaseSensitivePathsPlugin] Total filesystem reads: 25316

After walking around CaseSensitivePathsPlugin's source, and extra log for cache hitting(at

if (this.pathCache.has(dir)) {
callback(this.pathCache.get(dir));
return;
), I found below behavior(project path is redacted):

[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Reading directory /PROJECT_ROOT/node_modules/classnames
[CaseSensitivePathsPlugin] Hit cache for directory /PROJECT_ROOT/node_modules/antd/es/_util
[CaseSensitivePathsPlugin] Hit cache for directory /PROJECT_ROOT/node_modules/antd/es/tree
[CaseSensitivePathsPlugin] Hit cache for directory /PROJECT_ROOT/node_modules/antd/es/upload
[CaseSensitivePathsPlugin] Hit cache for directory /PROJECT_ROOT/node_modules/antd/es/upload
[CaseSensitivePathsPlugin] Hit cache for directory /PROJECT_ROOT/node_modules/lodash
[CaseSensitivePathsPlugin] Hit cache for directory /PROJECT_ROOT/node_modules/lodash
[CaseSensitivePathsPlugin] Hit cache for directory /PROJECT_ROOT/node_modules/antd/es/_util
[CaseSensitivePathsPlugin] Hit cache for directory /PROJECT_ROOT/node_modules
[CaseSensitivePathsPlugin] Hit cache for directory /PROJECT_ROOT/node_modules/react-lifecycles-compat
[CaseSensitivePathsPlugin] Hit cache for directory /PROJECT_ROOT/node_modules/classnames

The path /PROJECT_ROOT/node_modules/classnames has been read for 20 more times before cache can be used, which makes cache did not reach its goal (reuse result for the same directory).

After made some subtle changes with cache-related logic, It now read each unique directory only once and gains significant speedup on my project(same machine, same project as above timing).

CaseSensitivePathsPlugin took 1 min, 58.28 secs
[CaseSensitivePathsPlugin] Total filesystem reads(with visitedDir opt): 1487

Update 2021-02-23:

The subtle changes above(early changes on #53) are not correct, tests are failing. However, I'm trying to fix them.

Not working on Mac OSX

Module not found: Error: [CaseSensitivePathsPlugin] `/Users/chriscates/projects/Custom-Box-Builder/src/Components/Steps/StepContainer.js` does not match the corresponding path on disk `components`.
[0]  @ ./src/routes.js 43:21-64

Not sure how to debug this. Basically components is lowercase... and for some weird reason all of these things throw errors.

SyntaxError with v2.1.0 in Node v4

v2.1.0 was published with use of let but without a 'use strict' statement on the module.

Example failure in Node v4: https://travis-ci.org/insin/nwb/jobs/237641960

/home/travis/build/insin/nwb/node_modules/case-sensitive-paths-webpack-plugin/index.js:88

      let correctFilename = '!nonexistent';

      ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Testing Suggestion(s)

To E2E test this, for basic developer confidence, one could just create a basic JS project that's built with webpack, and has test coverage. Then, just write some tests for that demo project, demonstrating that requires now enforce case-sensitivity. In my case, I had to add the plugin to plugins on not only my webpack.config.js but also to the webpack config in my karma.conf.js.

Then, I created a jasmine spec file similar to the following:

describe("Case-Sensitive Paths Plugin", () => {
  it('shouldn\'t interfere with correctly-spelled imports', () => {
    const demoImport1 = require('../src/utils/api');
    expect(demoImport1).toBeDefined();
  });

  it('should cause mistakes in filename case to fail import', () => {
    expect(() => {const demoImport2 = require('../src/utils/API');}).toThrow();
  });

  it('should cause mistakes in path case to fail import', () => {
    expect(() => {const demoImport3 = require('../src/Utils/api');}).toThrow();
  });
});

Then I just run my standard unit-tests for the project. If the plugin is active, the last two tests pass, and if I disable it, they fail.

This is by no means an elegant solution that'll help you with ongoing development. But it gives me as an end-user some confidence that the plugin does what it says on the tin.

Very long build times

After switching on this module, we've experienced that the build time increased from less than two seconds to around 15. The consequence is that we can't really use this module.

Are we doing something wrong or is it because the module doesn't handle large projects too well?

Module not found while using storybook

Bug Report

Description

Getting
Module not found: Error: [CaseSensitivePathsPlugin] `/Users/xxx/yyy/webapp/src/components/github/GithubModal.js` does not match the corresponding path on disk `Github`.

Details

I'm having some issues with specific paths while using storybook.
The React (v16) app works well, but the storybook throughs Module not found: Error: [CaseSensitivePathsPlugin] on the path:

  • /Users/xxx/YYY/webapp/src/components/github/GithubModal.js

Two things to keep in mind:

  1. when I copy paste the path to a browser's url the file is there.
  2. In the path the YYY part has a dot in it, i.e aaa.bbb
  3. The React app is working
  4. Storybook works on other machines (High Sierra)

Versions

  • Webpack: 3.11.0
  • OSX El Capitan 10.11.6
  • React 16.3.1
  • Storybook/react: 3.4.4
  • case-sensitive-paths-webpack-plugin: 2.1.2 (from storybook's packages.json)

Module not found error; 2 files with same name but different extension

When I have two files in the same directory: one being a React component named Select.jsx and the other being a corresponding CSS module named select.scss, I get the following error, which I believe is incorrect (or at least misleading in its message):

Module not found: Error: [CaseSensitivePathsPlugin] `/app/assets/components/forms/Select.scss` does not match the corresponding path on disk `select.scss`.

If I change the name of the scss file to literally anything else (including the import statement within the jsx file), everything works fine. I've looked at the plugin's source code and haven't found any indication that it's ignoring file extensions, but it seems like that's what's going on. Am I missing something obvious in the source code or is something else causing this false positive?

I can move the scss file to another directory and that also fixes it, but I would rather not create a separate directory and I like giving the CSS module the same name as the React component it corresponds to.

(I'm using this plugin in the context of a Rails app via webpacker. I doubt that has any relevance, but including it just in case.)

Appreciate any help you can provide.

Speed improvements

Hey,

I ran some benchmarks on my webpack config and I saw that this plugin takes a significant time. After trying some rewrites and optimizations,I brought a 7-8 seconds build down to 5-6 seconds through the following speed improvements:

  • Using Promises. This gives us ~1 seconds. Promises were added in Nodejs v4, so no breaking changes.
  • Using Maps for caching. If the pathCache caches promises (Map<string, Promise<string[]) you can avoid concurrent fs.readDir for the same path.
  • Not doing recursive parent path reads. I see no point in doing this.
  • Adding a configurable ignore path. There's no point in checking node_modules, for example.

All in all, this brings 1200+ directory reads down to ~400. I also rewrote the package in Typescript to avoid any type bugs.

I can submit all improvements as separate PRs (for easier reviewing). Would you be interested in merging them?

Webpack v5 support

This plugin appears to break with Webpack 5, are there any plans to support the new version?

Does not work with Webpack 5

Here's the error:

/Users/xxx/node_modules/case-sensitive-paths-webpack-plugin/index.js:163
      let pathName = data.resource.split('?')[0];
                                   ^
TypeError: Cannot read property 'split' of undefined
    at primeCache (/Users/xxx/node_modules/case-sensitive-paths-webpack-plugin/index.js:163:36)
    at that.getFilenamesInDir (/Users/xxx/node_modules/case-sensitive-paths-webpack-plugin/index.js:130:5)
    at Array.fs.readdir (/Users/xxx/node_modules/case-sensitive-paths-webpack-plugin/index.js:66:5)
    at Storage.finished (/Users/xxx/node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at provider (/Users/xxx/node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9)
    at go$readdir$cb (/Users/xxx/node_modules/graceful-fs/graceful-fs.js:162:14)
    at FSReqCallback.args [as oncomplete] (fs.js:145:20)

Most likely due to API changes.

Deleting files shouldn't crash the plugin

I noticed that if I delete a folder while WebpackDevServer is running, this plugin crashes the process:

Compiling...
/Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/webpack-core/lib/NormalModuleMixin.js:151
                throw e;
                ^

Error: ENOENT: no such file or directory, scandir '/Users/dan/p/redux/examples/async/src/store'
    at Error (native)
    at Object.fs.readdirSync (fs.js:856:18)
    at CaseSensitivePathsPlugin.getFilenamesInDir (/Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/case-sensitive-paths-webpack-plugin/index.js:45:19)
    at CaseSensitivePathsPlugin.fileExistsWithCaseSync (/Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/case-sensitive-paths-webpack-plugin/index.js:63:26)
    at NormalModuleFactory.<anonymous> (/Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/case-sensitive-paths-webpack-plugin/index.js:109:34)
    at NormalModuleFactory.applyPluginsAsyncWaterfall (/Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/tapable/lib/Tapable.js:86:13)
    at onDoneResolving (/Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/webpack/lib/NormalModuleFactory.js:38:11)
    at onDoneResolving (/Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/webpack/lib/NormalModuleFactory.js:121:6)
    at /Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/webpack/lib/NormalModuleFactory.js:116:7
    at /Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/async/lib/async.js:726:13
    at /Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/async/lib/async.js:52:16
    at async.forEachOf.async.eachOf (/Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/async/lib/async.js:236:30)
    at _parallel (/Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/async/lib/async.js:717:9)
    at Object.async.parallel (/Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/async/lib/async.js:731:9)
    at /Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/webpack/lib/NormalModuleFactory.js:109:12
    at /Users/dan/p/redux/examples/async/node_modules/react-scripts/node_modules/async/lib/async.js:726:13

Error caused by two files with same name with different case and extensions

Module not found: Error: [CaseSensitivePathsPlugin] `/[path]/components/screener/screener.jsx` does not match the corresponding path on disk `Screener.jsx`.

This error was caused by having both a screener.json file and a Screener.jsx file. I confirmed this was the case by renaming the json file and having the error go away.

When importing, the JSON file was always imported with its extension whereas the JSX file was imported without (error did not go away even if I explicitly imported with .jsx extension).

Passing paths with null bytes to webpack's cache breaks the build

I get this error when trying to build my (sizable) webpack project in the production with this plugin active:

yarn run v1.22.10
$ rm -rf packages/web/dist/* && NODE_ENV=production yarn workspace web webpack
$ /Users/airhorns/Code/gadget/node_modules/.bin/webpack
(node:13837) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader
(Use `node --trace-deprecation ...` to show where the warning was created)
internal/fs/utils.js:618
    throw err;
    ^

TypeError [ERR_INVALID_ARG_VALUE]: The argument 'path' must be a string or Uint8Array without null bytes. Received '/Users/airhorns/Code/gadget/node_modules/es5-ext/string/\x00#/contains'
    at Object.readdir (fs.js:956:10)
    at go$readdir (/Users/airhorns/Code/gadget/node_modules/graceful-fs/graceful-fs.js:202:23)
    at Object.readdir (/Users/airhorns/Code/gadget/node_modules/graceful-fs/graceful-fs.js:184:12)
    at CacheBackend.provide (/Users/airhorns/Code/gadget/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:187:18)
    at CaseSensitivePathsPlugin.getFilenamesInDir (/Users/airhorns/Code/gadget/node_modules/case-sensitive-paths-webpack-plugin/index.js:58:6)
    at CaseSensitivePathsPlugin.fileExistsWithCase (/Users/airhorns/Code/gadget/node_modules/case-sensitive-paths-webpack-plugin/index.js:89:8)
    at checkFile (/Users/airhorns/Code/gadget/node_modules/case-sensitive-paths-webpack-plugin/index.js:147:10)
    at /Users/airhorns/Code/gadget/node_modules/case-sensitive-paths-webpack-plugin/index.js:169:7
    at CaseSensitivePathsPlugin.primeCache (/Users/airhorns/Code/gadget/node_modules/case-sensitive-paths-webpack-plugin/index.js:120:5)
    at onAfterResolve (/Users/airhorns/Code/gadget/node_modules/case-sensitive-paths-webpack-plugin/index.js:164:10) {
  code: 'ERR_INVALID_ARG_VALUE'
}
error Command failed with exit code 1.

AFAICT, there really is a null byte (\x00) in the path there. Very strangely, it's in the path of a folder on disk, that as far as I can tell does not have an actual null byte in the pathname. The folder exists just fine:

inspector ~/C/gadget (dependabot/npm_and_yarn/webpack-5.5.1) ➜  ls -lA /Users/airhorns/Code/gadget/node_modules/es5-ext/string/#
total 104
drwxr-xr-x  6 airhorns  staff   192 11 Nov 09:50 @@iterator
-rw-r--r--  1 airhorns  staff  1072 11 Nov 09:49 at.js
-rw-r--r--  1 airhorns  staff   217 11 Nov 09:49 camel-to-hyphen.js
-rw-r--r--  1 airhorns  staff   183 11 Nov 09:49 capitalize.js
-rw-r--r--  1 airhorns  staff   182 11 Nov 09:49 case-insensitive-compare.js
drwxr-xr-x  6 airhorns  staff   192 11 Nov 09:50 code-point-at
drwxr-xr-x  6 airhorns  staff   192 11 Nov 09:50 contains
-rw-r--r--  1 airhorns  staff   399 11 Nov 09:49 count.js
drwxr-xr-x  6 airhorns  staff   192 11 Nov 09:50 ends-with
-rw-r--r--  1 airhorns  staff   224 11 Nov 09:49 hyphen-to-camel.js
-rw-r--r--  1 airhorns  staff   419 11 Nov 09:49 indent.js
-rw-r--r--  1 airhorns  staff   787 11 Nov 09:49 index.js
-rw-r--r--  1 airhorns  staff   196 11 Nov 09:49 last.js
drwxr-xr-x  7 airhorns  staff   224 11 Nov 09:50 normalize
-rw-r--r--  1 airhorns  staff   582 11 Nov 09:49 pad.js
-rw-r--r--  1 airhorns  staff   419 11 Nov 09:49 plain-replace-all.js
-rw-r--r--  1 airhorns  staff   314 11 Nov 09:49 plain-replace.js
drwxr-xr-x  6 airhorns  staff   192 11 Nov 09:50 repeat
drwxr-xr-x  6 airhorns  staff   192 11 Nov 09:50 starts-with
-rw-r--r--  1 airhorns  staff   220 11 Nov 09:49 uncapitalize.js
inspector ~/C/gadget (dependabot/npm_and_yarn/webpack-5.5.1) ➜
ls -lA /Users/airhorns/Code/gadget/node_modules/es5-ext/string/#/contains
total 32
-rw-r--r--  1 airhorns  staff  203 11 Nov 09:49 implement.js
-rw-r--r--  1 airhorns  staff  111 11 Nov 09:49 index.js
-rw-r--r--  1 airhorns  staff  200 11 Nov 09:49 is-implemented.js
-rw-r--r--  1 airhorns  staff  177 11 Nov 09:49 shim.js

And the only thing that seems special about it is that it's got a # in the filename. I tried my best to search for null bytes within dependencies and my code and couldn't find any.

Removing this plugin from my webpack plugins list makes the bundling succeed.

This happens for me on any webpack version greater than 5.0.0-beta.22, including the latest which is 5.5.1. I am not sure what changed in 5.0.0-beta.23 that started complaining about the null bytes.

CaseSensitive breaks on Mac OS 10.13

Using this plugin in multiple environments, but this plugin breaks on Mac OS 10.13. If i disable the plugin my build completes and my app works.

Module not found: `/Users/calum/Sites/labbook-ui/src/JS/config.js` does not match the corresponding path on disk `js`.
resolve
    alias: {
      'react-native': 'react-native-web',
      'Components': path.resolve(__dirname, '../src/js/components/'),
      'Mutations': path.resolve(__dirname, '../src/js/mutations/'),
      'JS': path.resolve(__dirname, '../src/js/')

    }
}

Using:
webpack2.2
Node v6.11.1
[email protected]

Configurable logger

I'm embedding webpack into a cli context, and in order to control the logging output, it would be helpful to provide a logger interface to the plugin rather than outputting to console.log directly. Would you be willing to accept a PR for this?

Adding exclude option

In my project I have some modules with case sensivity problems, but all works fine. But if I use plugin, I can't produce successful build. Also I can't fix that problems because it's code from libraries from node_modules.
I think it would be useful if we can skip checking case sensivity issues in node_modules or in some libraries specified in config.

Any way to exclude node_modules?

Hi there! Thanks for the library.

I'm getting an error from a third-party package that I installed in node_modules.

ERROR in ./node_modules/react-codemirror/lib/Codemirror.js
Module not found: Error: [CaseSensitivePathsPlugin] `/Users/petrgazarov/workspace/clause/packages/clause-hub/node_modules/react-codemirror/src/codemirror.js` does not match the corresponding path on disk `Codemirror.js`.
 @ ./node_modules/react-codemirror/lib/Codemirror.js 38:42-63
 @ ./src/components/TemplateForm/Form.js
 @ ./src/components/TemplateForm/index.js
 @ ./src/containers/Dashboard/index.js
 @ ./src/routes/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8888 ./src/main.js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.