Roots Discourse

Mix watch compile time slow 30000ms+

I created a sage 10 project on ubuntu@raspi4. for 2 days now I am at unbelievably slow compile times, like around 30000ms, often higher.

I checked basically every result with different keywords via google. re-installed laravel-mix, webpack, etc.

    mix
  .setPublicPath('./public')
  .browserSync('sage.test');

mix
  .sass('resources/styles/app.scss', 'styles')
  .sass('resources/styles/editor.scss', 'styles')
  // .options({
  //   processCssUrls: false,
  //   postCss: [require('tailwindcss')],
  // });

mix
  .js('resources/scripts/app.js', 'scripts')
  .js('resources/scripts/customizer.js', 'scripts')
  .blocks('resources/scripts/editor.js', 'scripts')
  .autoload({ jquery: ['$', 'window.jQuery'] })
  .extract();

mix
  .copyDirectory('resources/images', 'public/images')
  .copyDirectory('resources/fonts', 'public/fonts');

mix
  .sourceMaps()
  .version();

Is building also that slow or only watching?
Are all CPU cores fully used during that slow watch?

building took 56s

during watch all cores are evenly used round 15-20%

with every saved change on watch:
1/5 entries 11/11 dependencies 2/10 modules 1 active
css-loader › postcss-loader › sass-loader › resources/styles/app.scss

it’s basically the same procedure like when executing yarn start

When the CPU is not the bottleneck it can well be the I/O. Are you compiling from a share or from a native file system on the raspy?

mounted ssd, other environments have no such problem :confused:

You can run the build with a nodejs profiler and then read the trace file.
This can point out the actual bottleneck on the raspi.

found kind of a workaround. thanks for the recommendation though.

added jit mode to tailwind.config.js now it’s down to 600-800ms

same repo on windows works fine without this mode

The discrepancy between systems could be explained by different tailwind versions maybe?
See this post