laravel-mix icon indicating copy to clipboard operation
laravel-mix copied to clipboard

Extremely slow Compiled Successfully in 459681ms

Open elrosi opened this issue 8 months ago • 2 comments

  • Laravel Mix Version: 6.0.49 (npm list --depth=0)
  • Node Version (node -v): v20.15.0
  • NPM Version (npm -v): 10.7.0
  • webpack : "^5.92.1",
  • sass: "^1.55.0",
  • sass-loader : "^14.2.1",
  • OS: WIN 10

Hi friends, I'm compiling JS, TS and SCSS in Laravel 10. Since some point the compilation mix watch initialization goes extremely slow. The initial compilation of the code takes more than 5 minutes. It gets stuck at 10% building (10%) 0/3 entries 1/3 dependencies 0/1 modules 1 active babel-loader ' ts-loader ' resources\src\js\app.ts and at 92%

Can you advise me if this problem is in some JS package or in the code that slows down the compiler. Thank you for your suggestions.

My webpack.mix.js:

const mix = require('laravel-mix'); const webpack = require('webpack'); const glob = require('glob'); const path = require('path'); const { VueLoaderPlugin } = require('vue-loader');

const mode = process.argv.indexOf("production") !== -1 ? "production" : "development"; console.log(Webpack mode: ${mode}); console.log(Webpack not in production: + !mix.inProduction());

let plugins = [ new VueLoaderPlugin(), new webpack.DefinePlugin({ VUE_OPTIONS_API: true, VUE_PROD_DEVTOOLS: false, VUE_PROD_HYDRATION_MISMATCH_DETAILS: false }) ];

mix.webpackConfig({ devtool: 'inline-source-map', plugins: plugins, watchOptions: { ignored: /node_modules/, }, ignoreWarnings: [{ module: /esri-leaflet/, message: /version/, }], resolve: { alias: { "@": path.resolve(__dirname, 'resources/src/js'), "@core": path.resolve(__dirname, 'resources/_keenthemes/src'), "@quotioo": path.resolve(__dirname, 'resources/quotioo'), "vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js", extensions: [".*", ".wasm", ".mjs", ".jsx", ".json", ".ts", ".js", ".tsx", ".vue"] } }, module: { rules: [ { test: /.css$/i, use: ["css-loader"], exclude: [ path.resolve(__dirname, "node_modules"), ], }, ], } });

// Build Metronic CSS mix .options({ processCssUrls: false }) .scripts(require('./resources/mix/plugins.js'), 'public/quotioo/js/plugins.bundle.js') .scripts(require('./resources/mix/scripts.js'), 'public/quotioo/js/scripts.bundle.js') .scripts(require('./resources/quotioo/js/scripts.js'), 'public/quotioo/js/app.scripts.bundle.js');

// Build custom 3rd party plugins console.log('-- Build custom 3rd party plugins --'); (glob.sync(resources/mix/vendors/!**!/!*.js) || []).forEach(file => { mix.scripts(require('./' + file), public/assets/${file.replace(path.normalize('resources/mix/vendors/'), 'plugins/custom/')}); });

// JS pages (single page use) console.log('-- JS pages (single page use) --'); (glob.sync(resources/quotioo/js/custom/!**!/!*.js) || []).forEach(file => { let output = ${file.replace(path.normalize(quotioo/js/custom), quotioo/js/custom).replace('resources', 'public')}; mix.scripts(file, output); });

// Custom app styles and javascript, console.log('-- Custom app styles and javascript --'); mix.sass(resources/_keenthemes/src/sass/style.scss, public/quotioo/css/style.bundle.css); mix.sass(resources/quotioo/scss/style.scss, public/quotioo/css/style.css) .sourceMaps(!mix.inProduction());

mix .ts('resources/src/js/app.ts', 'public/app/js') .vue({ version: 3, }) .sourceMaps(!mix.inProduction()) .disableNotifications();

Steps To Reproduce:

elrosi avatar Jun 25 '24 09:06 elrosi