-
Notifications
You must be signed in to change notification settings - Fork 60
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
Can we avoid calling fs.realpathSync(filepath) if filepath is already an absolute path? #99
Comments
I've opened a PR with this change: #100 |
The expected way to handle this to look at the event type. If it's a
deletion event then remove the path from the index. That's how it's done it
node-sass.
…On Thu., 3 Jan. 2019, 11:37 am rmacklin ***@***.*** wrote:
If so, would it be okay to add a guard check like if
(!path.isAbsolute(filepath)) before we call fs.realpathSync?
I've opened a PR with this change: #100
<#100>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjZWI01C9EUVz_j1-K9v-tuSW4fPr7Qks5u_VDMgaJpZM4ZnbFK>
.
|
Thanks for your response! If I remove the path from the index, it won't trigger recompilation of the ancestors. But I want that to happen so that the watch task will display an error if you remove a file that is still imported somewhere. If it's removed from the index, the watch task will just silently carry on despite there being broken code that the developer should address immediately. Is there another solution you'd be open to? |
I ran into an issue trying to use this plugin in my gulp watch task.
I have this code:
For the most part, this works pretty well, except if
event.path
refers to a watched file that was deleted. In that case, the watch task crashes with:which is caused by this line (on the current master branch, it's this line):
sass-graph/sass-graph.js
Line 117 in f6aa195
Since the watched file was removed,
fs.realpathSync
throws that error. However, theevent.path
value that gets passed for thefilepath
parameter is already an absolute path, so it seems like in that scenario it is unnecessary to callfs.realpathSync
. Does that seem reasonable? If so, would it be okay to add a guard check likeif (!path.isAbsolute(filepath))
before we callfs.realpathSync
?The text was updated successfully, but these errors were encountered: