nititech / php-vite-starter

A modern vanilla PHP-Vite starter repo, utilizing vite-plugin-php
https://github.com/nititech/php-vite-starter
MIT License
18 stars 1 forks source link

Production build throws an error #1

Closed verhulstd closed 3 months ago

verhulstd commented 3 months ago

First of all, thx for the great starter!

When building the project, visiting the production build throws an error:

Steps to reproduce:

$ npm i
$ npm run-php-install
$ npm run build

Then moving contents of /dist to a php/apache setup (c:/xampp/htdocs/test) accessing the ipsum page to test the build @ http://localhost/test/ipsum throws the following error:

Warning: require(system/main.php): Failed to open stream: No such file or directory in C:\xampp\htdocs\test\pages\ipsum.php on line 2

Fatal error: Uncaught Error: Failed opening required 'system/main.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\test\pages\ipsum.php:2 Stack trace: #0 {main} thrown in C:\xampp\htdocs\test\pages\ipsum.php on line 2
donnikitos commented 3 months ago

Hi @verhulstd, I am glad that you enjoy our starter repo!

It works on my machine! - All jokes aside... 🥲

After some investigation the case seems to occur during "local deployment", since usually in production the domain would point to the main directory, where the .htaccess resides and would execute all scripts from there on. But it seems that I managed to find a fix. It's on the way and should be online in a couple of minutes 😉

Cheers!