Skip to content

Commit

Permalink
fix: stylePostLoader injection for windows flat node_modules
Browse files Browse the repository at this point in the history
close #1284
  • Loading branch information
yyx990803 committed May 3, 2018
1 parent fb7d695 commit a9a4412
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/loaders/pitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports.pitch = function (remainingRequest) {
const loaders = this.loaders.slice(1) // remove self

// do not inject if user uses null-loader to void the type (#1239)
if (loaders.some(l => /(\/|\\)null-loader/.test(l.path))) {
if (loaders.some(l => /(\/|\\|@)null-loader/.test(l.path))) {
return
}

Expand Down Expand Up @@ -45,8 +45,8 @@ module.exports.pitch = function (remainingRequest) {

// Inject style-post-loader before css-loader for scoped CSS and trimming
if (query.type === `style`) {
const cssLoaderIndex = loaders.findIndex(l => /(\/|\\)css-loader/.test(l.path))
if (cssLoaderIndex) {
const cssLoaderIndex = loaders.findIndex(l => /(\/|\\|@)css-loader/.test(l.path))
if (cssLoaderIndex > -1) {
const afterLoaders = loaders.slice(0, cssLoaderIndex + 1)
const beforeLoaders = loaders.slice(cssLoaderIndex + 1)
const request = genRequest([
Expand Down

0 comments on commit a9a4412

Please sign in to comment.