Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR in ./node_modules/fbjs/lib/setImmediate.js Module not found: Error: [CaseSensitivePathsPlugin] #345

Open
mkaisercross opened this issue May 28, 2019 · 3 comments

Comments

@mkaisercross
Copy link

Case sensitivity issue from fbjs causing build to fail.

ERROR in ./node_modules/fbjs/lib/setImmediate.js
Module not found: Error: [CaseSensitivePathsPlugin] /Users/KaisMi01/sdev/capture-utility/node_modules/fbjs/lib/setimmediate.js does not match the corresponding path on disk setImmediate.js.

@leschekfm
Copy link

Got the same issue when running webpack on a project using draft-js which has fbjs as a dependency under windows.

@vyprichenko
Copy link

This issue still exists, but it is likely caused not by fbjs itself.
What is setImmediate.js intended to do is to re-export setImmediate function from setimmediate npm package (note difference in "i" casing). The latest contains setImmediate.js module (with capital "i" again). So, when you require('setimmediate'), you actually reference to node_modules/setimmediate/setImmediate.js, which is the problem pointed out by Webpack CaseSensitivePathsPlugin, probably a "false positive" in this case.

It seems like an issue not to be fixed soon, as it does not create a big problem except with Webpack, so we have two options:

  1. Disable CaseSensitivePathsPlugin which could to be not a preferred solution.
  2. Replace import('setimmediate') with import('setImmediate') in fbjs — CaseSensitivePathsPlugin is satisfied while npm still resolves a package correctly. This can be achieved with simple Webpack loader.

webpack.fbjs.loader.js

module.exports = function(source) {
    return source.replace(
        /require\((['"])setimmediate(['"])\)/g,
        "require($1setImmediate$2)"
    );
};

webpack.config.js

config.module.rules.push({
    test: /\.js$/,
    include: /node_modules/,
    use: path.resolve(__dirname, 'webpack.fbjs.loader.js')
});

@Aditya-Ace
Copy link

Aditya-Ace commented Sep 14, 2023

This didn't work for me, I am working on the SPFx React TS project, and I created the file webpack.fbjs.loader.js and added the code In my webpack.extend.js file in fast-serve folder. But nothing happened. Please help me on this, using older version of spfx.

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

No branches or pull requests

4 participants