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

fix: Bare imports not working sometimes #579

Merged
merged 1 commit into from
Jun 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/importsToResolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const path = require("path");
const utils = require("loader-utils");

const matchModuleImport = /^~([^\/]+|@[^\/]+[\/][^\/]+)$/g;
const matchModuleImport = /^~([^\/]+|@[^\/]+[\/][^\/]+)$/;

/**
* When libsass tries to resolve an import, it uses a special algorithm.
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe("sass-loader", () => {
sourceMap.should.not.have.property("file");
sourceMap.should.have.property("sourceRoot", fakeCwd);
// This number needs to be updated if imports.scss or any dependency of that changes
sourceMap.sources.should.have.length(11);
sourceMap.sources.should.have.length(13);
sourceMap.sources.forEach(sourcePath =>
fs.existsSync(path.resolve(sourceMap.sourceRoot, sourcePath))
);
Expand Down
3 changes: 3 additions & 0 deletions test/node_modules/module

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions test/node_modules/other-module

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions test/sass/imports.sass
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@
// See https://github.com/webpack-contrib/sass-loader/issues/556
/* @import util */
@import util
/* @import ~module */
@import ~module
/* @import ~other-module */
@import ~other-module
5 changes: 5 additions & 0 deletions test/scss/imports.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@
}
// The local util file should take precedence over Node's util module
// See https://github.com/webpack-contrib/sass-loader/issues/556
/* @import "util"; */
@import "util";
/* @import "~module"; */
@import "~module";
/* @import "~other-module"; */
@import "~other-module";