title: Wrong laravel mix rewrite url path when place project in subfolder
body: <p>I have deployed laravel react application on the server, inside a folder namely patients/ so the complete URL for the app is domain.com/patients</p>
  <p>app.js and app.css files are not found, I am facing a 404 error, because it is trying to serve files from domain.com/ instead of domain.com/patients/app.css and domain.com/patients/app.js if I change mix to asset or place mix inside asset in app.blade.php then, all the other assets like 0.js, 0.css are not found,</p>
  <p>following is the code in app.blade.php</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html class=&quot;h-full bg-gray-200&quot;&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0, maximum-scale=1.0&quot;&gt;
      &lt;link href=&quot;{{ mix('/css/app.css') }}&quot; rel=&quot;stylesheet&quot;&gt;
      &lt;script src=&quot;{{ mix('/js/app.js') }}&quot; defer&gt;&lt;/script&gt;
      &lt;title&gt;Clinical Laboratory | Provider Portal&lt;/title&gt;
      @routes
  &lt;/head&gt;
  &lt;body class=&quot;font-sans leading-none text-gray-800 antialiased&quot;&gt;
  
  @inertia
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>following is my webpack.mix.js</p>
  <pre><code>const cssImport = require('postcss-import');
  const cssNesting = require('postcss-nesting');
  const mix = require('laravel-mix');
  const path = require('path');
  const purgecss = require('@fullhuman/postcss-purgecss');
  const tailwindcss = require('tailwindcss');
  
  /*
   |--------------------------------------------------------------------------
   | Mix Asset Management
   |--------------------------------------------------------------------------
   |
   | Mix provides a clean, fluent API for defining some Webpack build steps
   | for your Laravel application. By default, we are compiling the Sass
   | file for the application as well as bundling up all the JS files.
   |
   */
  
  mix
    .react('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css/app.css')
    .options({
      postCss: [
        cssImport(),
        cssNesting(),
        tailwindcss('tailwind.config.js'),
        ...(mix.inProduction()
          ? [
              purgecss({
                content: [
                  './resources/views/**/*.blade.php',
                  './resources/js/**/*.js'
                ],
                defaultExtractor: content =&gt;
                  content.match(/[\w-/:.]+(?&lt;!:)/g) || [],
                whitelistPatternsChildren: [/nprogress/]
              })
            ]
          : [])
      ]
    })
    .webpackConfig({
      output: { chunkFilename: 'js/[name].js?id=[chunkhash]' },
      resolve: {
        alias: {
          '@': path.resolve('resources/js')
        }
      }
    })
    .version()
    .sourceMaps();
  </code></pre>
  <p>I have also tried adding <code>mix.setResourceRoot('/laravel/public/');</code> at the end</p>