title: Module not found: Error: Can't resolve 'fs' in React
body: <p>I want to implement a SASS compiler for my online editor, for this I want to use the npm package &quot;node-sass&quot;.
  However I get the error</p>
  <pre><code>Module not found: Error: Can't resolve 'fs' in '&lt;MyProjectPath&gt;\node_modules\fs.realpath'.
  </code></pre>
  <p>I already tried to disable the module via package.json by:</p>
  <pre><code>&quot;browser&quot;: {
     &quot;fs&quot;: false
  }
  </code></pre>
  <p>Furthermore I found another solution which runs via the webpack configuration, for this I created a file &quot;<code>config-overrides.js</code>&quot; in my root directory with this content using the npm package &quot;<code>react-app-rewired</code>&quot;:</p>
  <pre><code>module.exports = function override(def_config, env) {
    return {
      ...def_config,
      webpack: (config) =&gt; {
        config.resolve = {
          ...config.resolve,
          fallback: {
            &quot;fs&quot;: false,
          }
        }
        return config
      },
    }
  }
  </code></pre>
  <p>However, that doesn't fix my error either.
  Does anyone know how I can fix this error?
  I would also appreciate alternative suggestions on how to compile a SASS (as a string) into CSS (using ReactJS).</p>
  <p>My current package.json:</p>
  <pre><code>{
      &quot;name&quot;: &quot;client&quot;,
      &quot;version&quot;: &quot;0.1.0&quot;,
      &quot;private&quot;: true,
      &quot;proxy&quot;: &quot;http://localhost:3001&quot;,
      &quot;dependencies&quot;: {
          &quot;@codemirror/lang-javascript&quot;: &quot;^0.19.3&quot;,
          &quot;@testing-library/jest-dom&quot;: &quot;^5.16.1&quot;,
          &quot;@testing-library/react&quot;: &quot;^12.1.2&quot;,
          &quot;@testing-library/user-event&quot;: &quot;^13.5.0&quot;,
          &quot;assert&quot;: &quot;^2.0.0&quot;,
          &quot;axios&quot;: &quot;^0.24.0&quot;,
          &quot;codemirror&quot;: &quot;^5.65.0&quot;,
          &quot;console-browserify&quot;: &quot;^1.2.0&quot;,
          &quot;framer-motion&quot;: &quot;^5.5.5&quot;,
          &quot;jshint&quot;: &quot;^2.13.1&quot;,
          &quot;node-sass&quot;: &quot;^6.0.0&quot;,
          &quot;path&quot;: &quot;^0.12.7&quot;,
          &quot;react&quot;: &quot;^16.13.0&quot;,
          &quot;react-codemirror2&quot;: &quot;^7.2.1&quot;,
          &quot;react-dom&quot;: &quot;^16.13.0&quot;,
          &quot;react-router-dom&quot;: &quot;^6.2.1&quot;,
          &quot;react-scripts&quot;: &quot;5.0.0&quot;,
          &quot;styled-components&quot;: &quot;^5.3.3&quot;,
          &quot;util&quot;: &quot;^0.12.4&quot;,
          &quot;web-vitals&quot;: &quot;^2.1.2&quot;
      },
      &quot;scripts&quot;: {
          &quot;start&quot;: &quot;react-scripts start&quot;,
          &quot;build&quot;: &quot;react-scripts build&quot;,
          &quot;test&quot;: &quot;react-scripts test&quot;,
          &quot;eject&quot;: &quot;react-scripts eject&quot;
      },
      &quot;eslintConfig&quot;: {
          &quot;extends&quot;: [
              &quot;react-app&quot;,
              &quot;react-app/jest&quot;
          ]
      },
      &quot;browser&quot;: {
          &quot;fs&quot;: false
      },
      &quot;browserslist&quot;: {
          &quot;production&quot;: [
              &quot;&gt;0.2%&quot;,
              &quot;not dead&quot;,
              &quot;not op_mini all&quot;
          ],
          &quot;development&quot;: [
              &quot;last 1 chrome version&quot;,
              &quot;last 1 firefox version&quot;,
              &quot;last 1 safari version&quot;
          ]
      }
  }
  </code></pre>
  <p>I would be extremely grateful if someone could help me with this problem.</p>
  <p>Edit:
  If i add &quot;browser&quot;: {&quot;fs&quot;:false} to the node-module package itself, its working. But i want to push it without the node_modules folder to git and make it work by npm -i without having to change the node module itself. Any ideas how to change configuration of package.json from a module from my root package json?</p>