Skip to content

Commit 382bc5f

Browse files
David EllingsworthDavid Ellingsworth
authored andcommitted
Add functional test for css imports via package.json style property
1 parent b9e42be commit 382bc5f

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

fixtures/css/style_package_import.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import '~lib/test-pkg';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
content:'Style entrypoint';
3+
}

fixtures/lib/test-pkg/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"email": "david@desource.org"
77
},
88
"main":"js/javascript_entry.js",
9+
"style":"css/style_entry.css",
910
"sass":"css/sass_entry.scss"
1011
}

test/functional.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,6 +1985,26 @@ module.exports = {
19851985
config.addStyleEntry('sass', './css/sass_package_import.scss');
19861986

19871987
testSetup.runWebpack(config, () => {
1988+
// A successful compile is all that is needed to pass this test.
1989+
// If this test fails then the import in the above sass file
1990+
// is not loading the package's sass file.
1991+
done();
1992+
})
1993+
});
1994+
1995+
it('Import via "style" package property', (done) => {
1996+
const config = createWebpackConfig('web/build', 'dev');
1997+
1998+
config.setPublicPath('/build');
1999+
config.addAliases({
2000+
lib:path.resolve('./lib')
2001+
});
2002+
config.addStyleEntry('style', './css/style_package_import.css');
2003+
2004+
testSetup.runWebpack(config, () => {
2005+
// A successful compile is all that is needed to pass this test.
2006+
// If this test fails then the import in the above css file
2007+
// is not loading the package's style file.
19882008
done();
19892009
})
19902010
});

0 commit comments

Comments
 (0)