So I am running into a weird issue. I used Laravel Nova (2) command to generate a tool. It sits at ./nova-components/CustomNovaDashboard
. In order for the deployment to work on Laravel Vapor, I had to add the below to my parent composer.json
.
{
"type": "path",
"url": "./nova-components/CustomNovaDashboard",
"options": {
"symlink": false
}
}
This above allows the code to get deployed, because the absence of symlink
in options
would otherwise throw the following error:
include(/tmp/vendor/composer/../acme/custom-nova-dashboard/src/ToolServiceProvider.php): failed to open stream: No such file or directory
But the problem now is that when I run npm run watch
inside ./nova-components/CustomNovaDashboard
, the code in development never updates, because somehow there is a copy of the code that sits in vendor/acme/custom-nova-dashboard
that doesn't pick up the changes.
How can I solve this?
I found a solution, it was quite simple.
In my vapor.yml
, I had to add COMPOSER_MIRROR_PATH_REPOS=1
before composer install
.
build:
- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install'
- 'php artisan event:cache'
- 'npm ci && npm run dev && rm -rf node_modules'
This ensures the symbolic link generated by nova:tool
works on dev
and prod
similarly.
Just don't forget to set "symlink": true
in your composer.json
. Or leave it as is originally generated by the nova:tool
command.