Skip to content

Commit

Permalink
plugin-sass: fixes issue with regex not matching imports (#1932)
Browse files Browse the repository at this point in the history
* fix plugin-sass partial hmr

* plugin-sass partials regex fix

* Update plugin.js

Co-authored-by: Fred K. Schott <[email protected]>
  • Loading branch information
m9dfukc and FredKSchott authored Dec 11, 2020
1 parent 62d6f20 commit 2677864
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/plugin-sass/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ module.exports = function sassPlugin(_, {native, compilerOptions = {}} = {}) {
// check no ext: "_index" (/a/b/c/foo/_index)
this._markImportersAsChanged(filePathNoExt);
// check no underscore: "index.scss" (/a/b/c/foo/index.scss)
this._markImportersAsChanged(filePath.replace(/([\\\/])_/, '$1'));
this._markImportersAsChanged(filePath.replace(/\/_(?!.*\/)/, '$1'));
// check no ext, no underscore: "index" (/a/b/c/foo/index)
this._markImportersAsChanged(filePathNoExt.replace(/([\\\/])_/, '$1'));
this._markImportersAsChanged(filePathNoExt.replace(/\/_(?!.*\/)/, '$1'));
// check folder import: "foo" (/a/b/c/foo)
if (filePathNoExt.endsWith('_index')) {
const folderPathNoIndex = filePathNoExt.substring(0, filePathNoExt.length - 7);
Expand Down

1 comment on commit 2677864

@vercel
Copy link

@vercel vercel bot commented on 2677864 Dec 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.