1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-23 14:57:46 +01:00

fix: 🐛 Fix dev server quando si usano moduli custom

This commit is contained in:
Maicol Battistini 2021-10-15 16:47:17 +02:00
parent 451a1b66be
commit 450a849c16
No known key found for this signature in database
GPG Key ID: 4FDB0F87CDB1D34A
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,36 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
class DevServerFix extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'osm:dev-server-fix';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fix modules before starting the dev server';
/**
* Execute the console command.
*/
final public function handle(): int
{
foreach (glob(resource_path('static/vendor') . '/*/*/index.js', GLOB_NOSORT) as $file) {
$content = File::get($file);
File::put($file, str_replace('../../../index.js', '/resources/js/index.js', $content));
}
return Command::SUCCESS;
}
}

View File

@ -5,7 +5,7 @@
"private": true,
"main": "resources/js/index.js",
"scripts": {
"dev": "vite",
"dev": "php artisan osm:dev-server-fix && vite",
"build": "vite build",
"serve": "php artisan serve",
"watch": "vite build --watch",