settings updates, fixed
This commit is contained in:
+19
-19
@@ -2,11 +2,21 @@ import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
import { bunny } from 'laravel-vite-plugin/fonts';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { existsSync, readdirSync, realpathSync, statSync } from 'node:fs';
|
||||
import { existsSync, readdirSync, statSync } from 'node:fs';
|
||||
import { join, relative } from 'node:path';
|
||||
|
||||
const projectRoot = process.cwd();
|
||||
|
||||
/**
|
||||
* Compile assets from every Laravel module using the canonical module layout:
|
||||
*
|
||||
* Modules/<Module>/Resources/assets/css/app.css
|
||||
* Modules/<Module>/Resources/assets/js/app.js
|
||||
*
|
||||
* Only the canonical `Resources` directory is scanned. This avoids duplicate
|
||||
* entries on case-insensitive macOS filesystems where `Resources` and
|
||||
* `resources` resolve to the same files.
|
||||
*/
|
||||
function discoverModuleInputs() {
|
||||
const modulesPath = join(projectRoot, 'Modules');
|
||||
|
||||
@@ -15,7 +25,6 @@ function discoverModuleInputs() {
|
||||
}
|
||||
|
||||
const inputs = [];
|
||||
const physicalFiles = new Set();
|
||||
|
||||
for (const moduleName of readdirSync(modulesPath)) {
|
||||
const modulePath = join(modulesPath, moduleName);
|
||||
@@ -24,21 +33,13 @@ function discoverModuleInputs() {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const resourcesDirectory of ['Resources', 'resources']) {
|
||||
for (const entry of ['assets/css/app.css', 'assets/js/app.js']) {
|
||||
const candidate = join(modulePath, resourcesDirectory, entry);
|
||||
for (const entry of [
|
||||
'Resources/assets/css/app.css',
|
||||
'Resources/assets/js/app.js',
|
||||
]) {
|
||||
const candidate = join(modulePath, entry);
|
||||
|
||||
if (!existsSync(candidate)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const physicalPath = realpathSync(candidate);
|
||||
|
||||
if (physicalFiles.has(physicalPath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
physicalFiles.add(physicalPath);
|
||||
if (existsSync(candidate)) {
|
||||
inputs.push(relative(projectRoot, candidate));
|
||||
}
|
||||
}
|
||||
@@ -53,7 +54,7 @@ console.log('[Vite] Backend theme inputs:');
|
||||
console.log(' resources/themes/backend/assets/css/app.css');
|
||||
console.log(' resources/themes/backend/assets/js/passkeys.js');
|
||||
|
||||
if (moduleInputs.length) {
|
||||
if (moduleInputs.length > 0) {
|
||||
console.log('[Vite] Module inputs:');
|
||||
|
||||
for (const input of moduleInputs) {
|
||||
@@ -75,8 +76,6 @@ export default defineConfig({
|
||||
'resources/themes/backend/assets/**/*',
|
||||
'Modules/*/Resources/views/**/*.blade.php',
|
||||
'Modules/*/Resources/assets/**/*',
|
||||
'Modules/*/resources/views/**/*.blade.php',
|
||||
'Modules/*/resources/assets/**/*',
|
||||
'Modules/**/*.php',
|
||||
],
|
||||
|
||||
@@ -93,6 +92,7 @@ export default defineConfig({
|
||||
|
||||
server: {
|
||||
cors: true,
|
||||
|
||||
watch: {
|
||||
ignored: [
|
||||
'**/storage/framework/views/**',
|
||||
|
||||
Reference in New Issue
Block a user