Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parcel V2 - Sass changes do not update in DIST folder #5965

Open
RavenJe-dev opened this issue Mar 5, 2021 · 22 comments
Open

Parcel V2 - Sass changes do not update in DIST folder #5965

RavenJe-dev opened this issue Mar 5, 2021 · 22 comments

Comments

@RavenJe-dev
Copy link

🐛 bug report

After starting the live server on http://localhost:1234 with the command npm start and then changing a property of a sass file, nothing get updated in the CSS file generated in the dist folder.

🎛 Configuration (.babelrc, package.json, cli command)

{
  "name": "Test",
  "version": "1.0.0",
  "description": "test...",
  "default": "index.html",
  "scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html --dist-dir ./dist"
  },
  "author": "Test",
  "license": "ISC",
  "devDependencies": {
    "parcel": "^2.0.0-beta.1",
    "sass": "^1.32.8"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "regenerator-runtime": "^0.13.7"
  }
}

🤔 Expected Behavior

I should save the sass file while the server is running and the change should be reflected in the CSS file inside the dist folder.

😯 Current Behavior

After I save the file, the CSS file generated by parcel is not changed at all.

💁 Possible Solution

No idea how to fix this.

🔦 Context

I'm trying to edit sass files of my project and I would like to see the changes I make automatically in the dist folder.

💻 Code Sample

🌍 Your Environment

Tree

Software Version
Parcel ^2.0.0-beta.1
Node 14.15.4
npm/Yarn 6.14.10
Operating System Win 10
@OzzyCzech
Copy link

I have same issue here with follow index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">  
  <link media="all" rel="stylesheet" href="example.scss" />
  <title>Example</title>
</head>
<body>
</body>
</html>

and example.scss contains

body {
  background: blue
}

@import "embed.scss";

If you change anything in example.scss source is regenerated and updated with HMR. But when you try change embed.scss content it's regenerated few times, then regeneration stops and all changes in embed.scss are invisible. There is waring in console:

DevTools failed to load SourceMap: Could not parse content for http://localhost:1234/index.3ebff041.js.map: Unexpected token < in JSON at position 0

But do not know, if that can cause that behavior. here short video https://streamable.com/084nr5

@RavenJe-dev
Copy link
Author

I just moved to Parcel "parcel-bundler": "^1.12.3", and it works perfectly. So is definitely parcel 2 that has a bug.

@OzzyCzech
Copy link

Version ^2.0.0-nightly.425 also works

@mischnic
Copy link
Member

mischnic commented Mar 5, 2021

@RavenJe-dev Please try a recent nightly

@OzzyCzech
Copy link

version ^2.0.0-nightly.615 produce same error as version ^2.0.0-beta.1

@RavenJe-dev
Copy link
Author

Sorry for my mistake, I didn't properly migrate before. So version ^2.0.0-nightly.615 is giving me the same error. Not updating files.

@OzzyCzech
Copy link

Seems that version ^2.0.0-nightly.425 also generate errors, but less often :(

@mischnic
Copy link
Member

mischnic commented Mar 5, 2021

I can reproduce this with #5965 (comment).

It's probably the same issue as #5927.

@SCLeoX
Copy link

SCLeoX commented Apr 8, 2021

This is an issue for less as well.

For anyone waiting for this to be fixed, here are my workarounds:

Workaround 1: After changing anything in style files, manually stop the parcel process, delete the entire .parcel-cache folder, and restart parcel. (This obviously doesn't work if you edit the style files a lot.)

Workaround 2: Downgrade to parcel v1 (parcel-bundler), which doesn't have this issue.

@mischnic
Copy link
Member

mischnic commented Apr 8, 2021

Can someone try the latest nightly? #6072 might have fixed this

@SCLeoX
Copy link

SCLeoX commented Apr 8, 2021

@mischnic I just tried the latest nightly with less. The updating part seems to be working. However, I am keep getting errors like Error: EPERM: operation not permitted, rename 'C:\Data\Development\Project80\.parcel-cache\be\43d5e59127c3522873ea8abd96acae.blob.10476.1.1o' -> 'C:\Data\Development\Project80\.parcel-cache\be\43d5e59127c3522873ea8abd96acae.blob'. I have tried to delete .parcel-cache and rerun parcel, it seems to work for a while (1 minute?) and the same (or similar?) error shows up.

However, after a quick search, that seems to be another issue though...

@SCLeoX
Copy link

SCLeoX commented Apr 8, 2021

Just to clarify, the issue seems to be only with editing less files. The js files seem to be fine so far. Therefore, they might be related.

@krnlde
Copy link

krnlde commented Apr 8, 2021

I just tried it with the latest nightly and SCSS. I'm still seeing the same EPERM error. (I'm importing it from another yarn workspace)

{
  "devDependencies": {
    "@parcel/transformer-sass": "2.0.0-nightly.637",
    "parcel": "2.0.0-nightly.635",
  }
}

@mischnic
Copy link
Member

mischnic commented Apr 8, 2021

There are two open issues for EPERM:

@krnlde
Copy link

krnlde commented Apr 8, 2021

Thanks for the hint. That only helps a little since both are unresolved and untouched for a while.
Regarding the original Sourcemap error: this is gone for the latest nightlies I posted (win 10, yarn 1.22.10, node 15.14.0)

@mischnic
Copy link
Member

mischnic commented Apr 8, 2021

unresolved and untouched for a while

Because I wasn't able to reproduce either of them locally.

Can one of you share a reproduction (and steps what which file change, ... to trigger the error)?

@krnlde
Copy link

krnlde commented Apr 8, 2021

I'll prepare a repo. Should we continue over at #5036 then?

@mischnic
Copy link
Member

mischnic commented Apr 8, 2021

Probably yes. (Depending on which of the two cases you ran into. I'm not sure if they're related)

@shaunakv1
Copy link

Hi, This is still an issue and scss files don't rebuild. Any progress on this ticket?

@whaaaley
Copy link

whaaaley commented May 8, 2022

Yeah same here. Does anyone have any work arounds? I'm inserting SCSS into shadow dom and it's going to be rough without this. Deleting cache didn't do anything all. I'm stuck manually refreshing each CSS change. :C

@shaunakv1
Copy link

Upon some further testing, it looks like if I don't "save" with a syntax error on SCSS file, it builds into dist just fine. It's only when there is syntax error and it's thrown on the console, is when it seems any further changes don't compile into the dist, until I restart the server.

@TLATER
Copy link

TLATER commented Jun 23, 2022

#6124 had the same exact symptoms @shaunakv1 reports, and was ultimately resolved with a fix to the way parcel handles cache invalidation when transformers throw errors in #7547. I suspect this is an issue different from the one originally reported here.

The workarounds described in #6124 work here too, just touching any non-scss file that ultimately imports the one I'm editing kicks off parcel's rebuild, which makes the workflow quite a bit nicer than stopping and restarting the server all the time, but it's of course still suboptimal.

I'd love to actually fix this, but I don't understand parcel or the scss-transformer internals well enough. Does anyone have a clue why the fix might not have taken for scss?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants