When we use mix.extract (); it generates three main files:
app.jsvendor.jsmanifest.jsThe files of vendor.js andmanifest.js are fine that are always loaded, but in the app.js there is a large amount of code that we do not use in some pages.
hello.js, counter.js, todos.js, header.js, link.js, card.jsvendor.jsmanifest.js``` blade
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
</head>
<body>
<div id="app">
<div id="header"></div> <!-- JS component -->
@yield('content')
</div>
<script src="/js/manifest.js"></script>
<script src="/js/vendor.js"></script>
<script src="/js/header.js"></script>
@stack('scripts')
</body>
````
``` blade
@extends('layouts.app')
@section('content')
@endsection
@push('scripts')
@endpush
````
Seems like dynamic imports would be more appropriate here.
Seems like dynamic imports would be more appropriate here.
Of course, but it would be better to divide our code when we use mix.extract();
Right. Dynamic imports will divide your code for you. You're asking for a feature that basically already exists, is what I'm saying.
Agree with @QWp6t. You can use dynamic imports once Mix 5 is out (after webpack 5 is released).