require.resolve problem on Linux/gitlab Error: You attempted to import /a/b/node_modules/*/index.js which falls outside of the project src/ directory

Viewed 14

I've been struggling with this all day: I have a React project, and am using react-app-rewired to add stuff like "https", "stream", "crypto", etc.

Unfortunately, using "require.resolve('ANYTHING')", in the 'config-overrides.js' results in an ERROR when the project is pushed to build via the Gitlab CI (which is running some sort of linux as far as I'm aware)

The error: (when running npm build on Windows - it works, it fails on the CI)

Failed to compile.
Module not found: Error: You attempted to import /builds/Team/Project-name/node_modules/console-browserify/index.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
You can either move it inside src/, or add a symlink to it from project's node_modules/.

I've also tried using the NodePolyfillPlugin, but the problem persists. E.g. its a require.resolve issue.

0 Answers
Related