Apr 27, 2022
0
Level 6
JS not functioning if not running php artisan run:dev
Hi guys! I created this project in Inertia-vue. I already compile the assets of the nifty theme in the webpack and theme is loading well but some JS is not functioning specially the sidebar area.
To be able for the JS to run I need to run php artisan run:dev I already try to run php artisan run:watch but the JS is not working.
This how I implemented the addition theme cs and js in app.blade.php
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title inertia>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap">
<!-- Styles -->
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
<link rel="stylesheet" href="{{ mix('css/main.css') }}">
<!-- Scripts -->
@routes
<script src="{{ mix('js/app.js') }}" defer></script>
@inertiaHead
</head>
<body class="font-sans antialiased">
@inertia
@env ('local')
<script src="http://localhost:8080/js/bundle.js"></script>
@endenv
<script src="{{ mix('js/main.js') }}" defer></script>
</body>
and this is my webpack
mix.styles([
'resources/admin/assets/css/bootstrap.min.css',
'resources/admin/assets/css/nifty.min.css',
], 'public/css/main.css')
.scripts([
'resources/admin/assets/js/bootstrap.min.js',
'resources/admin/assets/js/nifty.min.js',
'resources/admin/assets/pages/dashboard-1.min.js',
], 'public/js/main.js');
Please or to participate in this conversation.