title: Module not found: Error: Can't resolve FILE in PATH - Webpack or Babel issue
body: <p>Src folder structure:</p>
  <pre><code>|   index.tsx
  |   
  +---components
  |       Nav.tsx
  |       
  \---pages
          login.tsx
  </code></pre>
  <p>index.tsx:</p>
  <pre><code>import { BrowserWindow, app } from &quot;electron&quot;;
  import React from &quot;react&quot;;
  import ReactDOM from &quot;react-dom&quot;;
  import Login from &quot;./pages/login&quot;;
  
  const main = async () =&gt; {
      ReactDOM.render(&lt;Login /&gt;, document.getElementById(&quot;app&quot;));
  };
  main();
  </code></pre>
  <p>login.tsx:</p>
  <pre><code>import React from &quot;react&quot;;
  
  interface loginProps {}
  
  const Login: React.FC&lt;loginProps&gt; = ({}) =&gt; {
      return (
          &lt;div&gt;
              &lt;h1&gt;HelloWorld&lt;/h1&gt;
          &lt;/div&gt;
      );
  };
  export default Login;
  </code></pre>
  <p>webpack:</p>
  <pre><code>const HtmlWebpackPlugin = require(&quot;html-webpack-plugin&quot;);
  const path = require(&quot;path&quot;);
  
  module.exports = {
      entry: &quot;./src/index.tsx&quot;,
      module: {
          rules: [
              {
                  test: /\.tsx?$/,
                  use: [&quot;babel-loader&quot;, &quot;ts-loader&quot;],
                  include: [path.resolve(__dirname, &quot;src&quot;)],
              },
          ],
      },
      output: {
          publicPath: &quot;public&quot;,
          filename: &quot;bundle.js&quot;,
          path: path.resolve(__dirname, &quot;public&quot;),
      },
      resolve: {
          fallback: {
              path: require.resolve(&quot;path-browserify&quot;),
          },
      },
      plugins: [
          new HtmlWebpackPlugin({
              template: &quot;./public/index.html&quot;,
          }),
      ],
      target: &quot;electron-main&quot;,
  };
  </code></pre>
  <p>babel:</p>
  <pre><code>{
      &quot;presets&quot;: [&quot;@babel/preset-env&quot;, &quot;@babel/preset-react&quot;]
  }
  </code></pre>
  <p>I can't provide much more information on this since the compiler only outputs the error mentioned in title:
  ERROR in ./src/index.tsx
  Module not found: Error: Can't resolve './pages/login' in '..\src'. Something is probably not linked correctly. webpack 5.5.1 compiled with 1 error in 4971 ms</p>