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.

Javascript File Deleted After SCSS Change

See original GitHub issue
  • Laravel Mix Version: 0.12.1
  • Node Version: 6.9.5
  • NPM Version: 3.10.10
  • OS: OS X 10.12

Description:

After initial compilation when changing a SCSS file in a build that contains only scss and js then when the scss is changed the JS is deleted.

Steps To Reproduce:

On OSX follow these instructions:

#Create a temp project
mkdir /tmp/jsbug
cd /tmp/jsbug
#Create a default package.json
npm init -y
npm install lavavel-mix --save-dev
cp -r node_modules/laravel-mix/setup/** ./
touch style.scss
touch app.js

Copy in the lines to the package.json like in the documentation

  "scripts": {
    "dev": "cross-env NODE_ENV=development webpack --progress --hide-modules",
    "watch": "cross-env NODE_ENV=development webpack --watch --progress --hide-modules",
    "hot": "cross-env NODE_ENV=development webpack-dev-server --inline --hot",
    "production": "cross-env NODE_ENV=production webpack --progress --hide-modules"
  }

Edit the webpack.mix.js file to contain for the jobs:

let mix = require('laravel-mix');
mix.js('app.js', 'dist/')
.sass('style.scss', 'dist/');

Now run npm run watch

Initially this will create the javascript file. Then edit the sass file. The javascript file is then deleted.

In addition an example github repo is here:

https://github.com/kevin-coyle/laravel-mix-bug

Thanks for any help that you can give.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:20 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
JeffreyWaycommented, Jun 6, 2017

Ah okay, good to know thanks.

Mix 1.0 will automatically fix this. I’ll be tagging it later this week.

2reactions
njbarrettcommented, Jun 1, 2017

I’ve got this problem as well on 0.12.1. The issue does not occur in 0.11.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript File Deleted After SCSS Change #844 - GitHub
Description: After initial compilation when changing a SCSS file in a build that contains only scss and js then when the scss is...
Read more >
CSS file can be changed or deleted but the css on-page ...
1 Answer 1 ... Fixed! I simply needed to wait a few mins after each change before reloading, the page didn't respond to...
Read more >
Dynamically removing an external JavaScript or CSS file
To remove an external JavaScript or CSS file from a page, the key is to hunt them down first by traversing the DOM,...
Read more >
Files inside the CSS folder gets automatically deleted when I ...
When i set my uploads path to ../ on file system, my files inside the css folder get deleted when i clear the...
Read more >
will-change - CSS: Cascading Style Sheets - MDN Web Docs
The will-change CSS property hints to browsers how an element is expected to change. Browsers may set up optimizations before an element is ......
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