Custom Tool is not showing View, Laravel Nova
I just followed all the steps to make a custom Tool Laravel/Nova/custom/tools But it doesn't show the default view, there are not console error(js) or php error but the view is empty.
namespace Mihrbi\CompanyConfig; use Laravel\Nova\Nova; use Laravel\Nova\Tool; class CompanyConfig extends Tool { /** * Perform any tasks that need to happen when the tool is booted. * * @return void */ public function boot() { // Nova::script('company-config', __DIR__.'/../dist/js/tool.js'); // Nova::style('company-config', __DIR__.'/../dist/css/tool.css'); Nova::serving(function (ServingNova $event) { Nova::script('company-config', __DIR__.'/../dist/js/tool.js'); Nova::style('company-config', __DIR__.'/../dist/css/tool.css'); }); } /** * Build the view that renders the navigation links for the tool. * * @return \Illuminate\View\View */ public function renderNavigation() { return view('company-config::navigation'); } }
those are the only changes I made, to use Nova::serving to avoid "nova-api/scripts/company-config 500 (Internal Server Error)"
That happen when I remove the Nova::serving and npm run prod
local.ERROR: file_get_contents(/home/site/nova-components/CompanyConfig/src/../dist/css/tool.css): failed to open stream: No such file or directory
here my package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"cross-env": "^5.0.0",
"laravel-mix": "^1.0"
},
"dependencies": {
"vue": "^2.5.0"
}
}
Delete the Nova::serving
line and run npm run prod
inside the root directory of the tool so that it publishes the JS and CSS files in the dist
folder