79632446

Date: 2025-05-21 17:03:26
Score: 0.5
Natty:
Report link

In order to keep the structure that I want in resources folder, I have done like this:

In the views -> admin -> app.blade.php:

 {{ Vite::useBuildDirectory('admin')->withEntryPoints(['resources/admin/sass/app.scss', 'resources/admin/js/app.js']) }}

In the resources -> admin folder, I let it only the js + sass folders (the app itself) and in the root project I have added those two configs:

vite.admin.config.js
vite.store.config.js

vite.admin.config.js

import {defineConfig} from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';

export default defineConfig({
    plugins: [
        laravel({
            buildDirectory: 'admin',
            input: ['resources/admin/sass/app.scss', 'resources/admin/js/app.js'],
            refresh: true,
        }),
        vue({
            template: {
                transformAssetUrls: {
                    base: null,
                    includeAbsolute: false,
                },
            },
        }),
    ],    
    resolve: {
        alias: {
            '@': '/resources/admin/js',
        }
    },
    server: {
        host: '0.0.0.0',
        hmr: {
            clientPort: 5173,
            host: 'localhost',
        },
        fs: {
            cachedChecks: false
        }
    }
});

and in the package.json:

...
   "scripts": {
        "dev.store": "vite --config vite.store.config.js",
        "build.store": "vite build --config vite.store.config.js",
        "dev.admin": "vite --config vite.admin.config.js",
        "build.admin": "vite build --config vite.admin.config.js"
    },
...

and is working, the dev server and the build :)

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: calin24