#Hide "build" in the URL

1 messages · Page 1 of 1 (latest)

little stone
#

After building my Laravel/Vue app in local, the URL looks like http://crm.local/**build**/login.

I'm using Vite as a frontend server and there is the content of vite.config.js:

import vue from '@vitejs/plugin-vue'
...
import svgLoader from 'vite-svg-loader'

// https://vitejs.dev/config/
export default defineConfig({
  css: {
    preprocessorOptions: {
      scss: {
        api: 'modern',
        quietDeps: true,
        quiet: true,
      },
    },
  },
  plugins: [vue({
    template: {
      transformAssetUrls: {
        base: null,
        includeAbsolute: false,
      },
    },
  }), vueJsx(), laravel({
    input: ['resources/js/main.js'],
    refresh: true,
  }),
  vuetify({
    styles: {
      configFile: 'resources/styles/variables/_vuetify.scss',
    },
  }), Components({
    dirs: ['resources/js/@core/components', 'resources/js/components'],
    dts: true,
  }),
  AutoImport({
    imports: ['vue', 'vue-router', '@vueuse/core', '@vueuse/math', 'pinia'],
    vueTemplate: true,

    // :information_source: Disabled to avoid confusion & accidental usage
    ignore: ['useCookies', 'useStorage'],
    eslintrc: {
      enabled: true,
      filepath: './.eslintrc-auto-import.json',
    },
  }), svgLoader()],
  define: { 'process.env': {} },
  resolve: {
    alias: {
      '@core-scss': fileURLToPath(new URL('./resources/styles/@core', import.meta.url)),
      '@layouts': fileURLToPath(new URL('./resources/js/@layouts', import.meta.url)),
      '@images': fileURLToPath(new URL('./resources/images/', import.meta.url)),
      '@styles': fileURLToPath(new URL('./resources/styles/', import.meta.url)),
      '@configured-variables': fileURLToPath(new URL('./resources/styles/variables/_template.scss', import.meta.url)),
    },
  },
  build: {
    chunkSizeWarningLimit: 5000,
  },
  optimizeDeps: {
    exclude: ['vuetify'],
    entries: [
      './resources/js/**/*.vue',
    ],
    include: ['fast-deep-equal'],
  },
})```
#

And there is my vhost:

    ServerName crm.local
    ServerAlias www.crm.local
    DocumentRoot "D:/crm/public"
    ErrorLog "logs/crm.local-error.log"
    <Directory "D:/crm/public">
    AllowOverride All
        Require all granted    
    </Directory>
</VirtualHost>```

When I open the app on the browser, after running vite build, I can see the webpage, but I want to remove the build term in the URL.

I tried to add base: '/' in the vite.config.js file to remove it, but it damages all styles.

The build folder is located at D:/crm/public/.

Any help?
unique spruce
#

Looks like the build folder is actually at D:/crm/public/build. would changing your Vhost to this path works