Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PavelSima's avatar

Vite build problem

Hi, I am upgrading from Mix to Vite (now I have Laravel v9.52.4, Vite I am using is v4.4.9 and Vue v3.3.4) and I did make it work locally without problem, but now I am having problem with production build. When I try to run vite build it returns:

error during build:
Error: ENOENT: no such file or directory, stat '~/project_name/src'

My vite config:

export default defineConfig({
  server: {
    hmr: {
      host: 'localhost',
    },
  },
  plugins: [
    laravel({
      input: [
        '/resources/frontend/app.js',
        '/resources/common/styles/variables.css'
        '/resources/common/styles/common.css'
      ],
      refresh: true,
    }),
    vue({
      template: {
        transformAssetUrls: {
          base: null,
          includeAbsolute: false,
        },
      },
    }),
    eslint({
      fix: true,
    }),
    stylelint({
      include: ['**/*.{vue,htm,html,css,sss,less,scss,sass}'],
    }),
  ],
  resolve: {
    alias: {
      '@common': '/resources/common',
      '@frontend': '/resources/frontend',
    },
    extensions: ['.js', '.vue', '.json'],
  },
  define: {
    'process.env': {},
  },
})

and this is my blade template:

<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>{{ config('app.name') }}</title>

    <!-- Styles -->
    <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Round|Material+Icons+Sharp" rel="stylesheet" type="text/css">
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/quasar.prod.css" rel="stylesheet" type="text/css">
    @vite(['resources/frontend/app.js', 'resources/common/styles/variables.css', 'resources/common/styles/common.css'])
</head>
<body>
<noscript>
    You need to enable JavaScript to run this app.
</noscript>

<div id="app"></div>

<style>
    .beamer_defaultBeamerSelector {
        background-color: #42475e
    }
</style>

</body>
</html>

I tried to specify the folder where it should build, and even the blade template, but nothing helps. Anyone have any idea what could be problem?

Thanks :)

0 likes
0 replies

Please or to participate in this conversation.