Fixed Vite production builds

This commit is contained in:
Chris Kankiewicz
2025-03-17 14:09:10 -07:00
parent a817bf4f96
commit d9eb216eac
3 changed files with 7 additions and 5 deletions

View File

@@ -19,10 +19,11 @@ return [
/** Path definitions */
'base_path' => dirname(__DIR__, 2),
'app_path' => dirname(__DIR__),
'assets_path' => string('{app_path}/assets'),
'cache_path' => string('{app_path}/cache'),
'config_path' => string('{app_path}/config'),
'files_path' => env('FILES_PATH', get('base_path')),
'manifest_path' => string('{app_path}/manifest.json'),
'manifest_path' => string('{assets_path}/manifest.json'),
'source_path' => string('{app_path}/src'),
'translations_path' => string('{app_path}/translations'),
'views_path' => string('{app_path}/views'),

View File

@@ -35,8 +35,8 @@ class Vite extends ViewFunction
return Collection::make($assets)->map(
static fn (string $asset): string => match (mb_substr($asset, (int) mb_strrpos($asset, '.'))) {
'.js' => sprintf('<script type="module" src="app/%s"></script>', $manifest->{$asset}->file),
'.css' => sprintf('<link rel="stylesheet" href="app/%s">', $manifest->{$asset}->file),
'.js' => sprintf('<script type="module" src="%s"></script>', $manifest->{$asset}->file),
'.css' => sprintf('<link rel="stylesheet" href="%s">', $manifest->{$asset}->file),
default => throw new UnexpectedValueException(sprintf('Unsupported asset type: %s', $asset))
}
);

View File

@@ -4,9 +4,10 @@ import tailwindcss from '@tailwindcss/vite'
export default defineConfig(({ command }) => {
return {
build: {
outDir: 'app',
outDir: '.',
emptyOutDir: false,
manifest: 'manifest.json',
assetsDir: 'app/assets',
manifest: 'app/assets/manifest.json',
rollupOptions: {
input: [
'app/resources/css/app.css',