Wrong assets paths showing when using laravel mix with the Laravel Modules

  laravel, laravel-mix, laravel-models, php

I have setup the project on the subdomain like https://example.com/newapi. Also i have setup the module in the project OrderManagement with command composer require nwidart/laravel-modules
it has created all the file structure in the OrderMangement folder. Also i can use the routes with

But facing issue assets with laravel mix and it’s showing the 404 file not found.

Step 1: npm install laravel-mix-merge-manifest –save-dev inside the ordermanagement folder

Step 2: npm run dev

enter image description here

<!DOCTYPE html>
<html lang="en">
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Module OrderManagement</title>

       {{-- Laravel Mix - CSS File --}}
       {{-- <link rel="stylesheet" href="{{ mix('css/ordermanagement.css') }}"> --}}


        {{-- Laravel Mix - JS File --}}
        {{-- <script src="{{ mix('js/ordermanagement.js') }}"></script> --}}


const dotenvExpand = require('dotenv-expand');
dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/ }));

const mix = require('laravel-mix');

mix.js(__dirname + '/Resources/assets/js/app.js', 'js/ordermanagement.js')
    .sass(__dirname + '/Resources/assets/sass/app.scss', 'css/ordermanagement.css');

if (mix.inProduction()) {

Also i applied solution of setResourceRoot() in the mix from help of below link but it also not working .
Please help me how to setup laravel mix with laravel module in subfolder.


Source: Laravel

Leave a Reply