Skip to content

Commit 2d6045b

Browse files
test: support import index file from package (#649)
1 parent aa64e1b commit 2d6045b

File tree

6 files changed

+19
-0
lines changed

6 files changed

+19
-0
lines changed

test/index.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ implementations.forEach((implementation) => {
173173
));
174174
it('should resolve sass field correctly', () =>
175175
execTest(`import-sass-field`));
176+
// Works only in dart-sass implementation
177+
if (implementation === dartSass) {
178+
it('should resolve index file in module correctly', () =>
179+
execTest('import-index'));
180+
}
176181
});
177182
describe('custom importers', () => {
178183
it('should use custom importer', () =>

test/node_modules/sass-package-with-index/index.sass

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/node_modules/scss-package-with-index/index.scss

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/sass/import-index.sass

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "~sass-package-with-index"

test/scss/import-index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "~scss-package-with-index";

test/tools/createSpec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ function createSpec(ext) {
113113
return;
114114
}
115115

116+
if (fileWithoutExt === 'import-index' && implementation !== dartSass) {
117+
// Skip CSS imports for all implementations that are not node-sass
118+
// CSS imports is a legacy feature that we only support for node-sass
119+
// See discussion https://github.com/webpack-contrib/sass-loader/pull/573/files?#r199109203
120+
return;
121+
}
122+
116123
sassOptions.functions = customFunctions(implementation);
117124

118125
const [name] = implementation.info.split('\t');

0 commit comments

Comments
 (0)