question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

js + sass + copy = watch/compile loop

See original GitHub issue

Hi

It seems that using mix.js() + mix.sass() + mix.copy() causes npm run watch to keep compiling.

Here’s the code I’m using:

mix
    .js('./resources/assets/js/nebula.js', './js')
    .sass('./resources/assets/sass/nebula.scss', './css')
    .copy('./js/nebula.js', '../../../public/vendor/nebula.js')
    .copy('./css/nebula.css', '../../../public/vendor/nebula.css')

I’m running mix inside a packages/vendor/name folder, so not in the project’s route.

When I run npm run watch my console gets crazy and the only things I can see are

WAIT: compiling...
WAIT: Compiled successfully in Nms
WAIT: compiling...
WAIT: Compiled successfully in Nms
WAIT: compiling...
WAIT: Compiled successfully in Nms
WAIT: compiling...
WAIT: Compiled successfully in Nms

and so on.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
codewithfeelingcommented, May 19, 2017

I am also seeing this issue on a brand new install of Laravel 5.4 but without even running the copy command. My mix file is really simple:

mix.js('resources/assets/js/main.js', 'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css');

I have commented out both parts in turn and it’s the processCssUrls part of the sass script that causes the loop. If I comment out the background definition here:

body {
  background: url('images/bg-widescreen.jpg') no-repeat;

Then it compiles with no issues. Also if I change the mix file to:

mix.js('resources/assets/js/main.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css')
   .options({ processCssUrls: false });

It compiles with no issues.

1reaction
glennjacobscommented, May 16, 2017

@ruchern I don’t think it’s that in my case.

This is my webpack.mix.js

const { mix } = require('laravel-mix');

mix.setPublicPath(__dirname + "/public");
mix.setResourceRoot(__dirname + "/resources");

mix.js('resources/assets/js/app.js', 'js')
    .sass('resources/assets/sass/app.scss', 'css')
    .copy('resources/assets/images', 'public/images', false);

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

mix.copy('public', '../../../public/vendor/my_package', false);
Read more comments on GitHub >

github_iconTop Results From Across the Web

js + sass + copy = watch/compile loop · Issue #329 - GitHub
Hi It seems that using mix.js() + mix.sass() + mix.copy() causes npm run watch to keep compiling. Here's the code I'm using: mix...
Read more >
Webpack 4. Compile scss to separate css file - Stack Overflow
Im trying to compile scss into a separate css file with no luck. As it is now the css gets into the bundle.js...
Read more >
The easiest way to watch and Compile Sass in 5 Steps
To compile Sass via the command line first, we need to install node.js. The easiest way is downloading it from the official website ......
Read more >
Sass: @for
Each number along the way is assigned to the given variable name. If to is used, the final number is excluded; if through...
Read more >
How to compile Sass files in Visual Studio and Webpack
Open this new Sass file and copy the following: ... empty JavaScript file under the root of the application and name it webpack.config.js...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found