hasanhatem's avatar

Js files in laravel mix production take 3 seconds to load on server

Hello, when I run

npm run prod

and upload this files to the server

manifest.js
vendor.js
app.js

i have problem with (manifest, vendor) each one take 3 seconds to load

my webpack.mix.js:

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

mix.js("resources/js/app.js", "public/js")
    .js("resources/js/admin.js", "public/js")
    .sass("resources/sass/app.scss", "public/css").purgeCss()
    .sass("resources/sass/admin.scss", "public/css").purgeCss()
    .copy('node_modules/ckeditor/config.js', 'public/js/ckeditor/config.js')
    .copy('node_modules/ckeditor/styles.js', 'public/js/ckeditor/styles.js')
    .copy('node_modules/ckeditor/contents.css', 'public/js/ckeditor/contents.css')
    .copyDirectory('node_modules/ckeditor/skins', 'public/js/ckeditor/skins')
    .copyDirectory('node_modules/ckeditor/lang', 'public/js/ckeditor/lang')
    .copyDirectory('node_modules/ckeditor/plugins', 'public/js/ckeditor/plugins')
    .sourceMaps(true, 'source-map')
    .extract(['jquery']);

if (mix.inProduction()) {
    mix.version();
}

and app.js :

require("./bootstrap");

// Lazyload
import LazyLoad from "vanilla-lazyload";

var myLazyLoad = new LazyLoad({
    // Your custom settings go here
});

$(document).ready(function() {
    $(".page-title ").on("click", function(e) {
        e.preventDefault();
        $(this)
            .next()
            .slideToggle();
        $(this)
            .find("h2")
            .find("i")
            .toggleClass("active-title-icon");
    });

    $(".open-side").on("click", function(e) {
        e.preventDefault();

        $(".side-categories").slideToggle();
    });
});

i don't use a lot of codes in app.js. how can solve this problem?

why manifest and vendor big and take 3 seconds to loaded?

0 likes
1 reply

Please or to participate in this conversation.