Commit a9a4412f authored by Evan You's avatar Evan You

fix: stylePostLoader injection for windows flat node_modules

close #1284
parent fb7d6953
...@@ -13,7 +13,7 @@ module.exports.pitch = function (remainingRequest) { ...@@ -13,7 +13,7 @@ module.exports.pitch = function (remainingRequest) {
const loaders = this.loaders.slice(1) // remove self const loaders = this.loaders.slice(1) // remove self
// do not inject if user uses null-loader to void the type (#1239) // 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 return
} }
...@@ -45,8 +45,8 @@ module.exports.pitch = function (remainingRequest) { ...@@ -45,8 +45,8 @@ module.exports.pitch = function (remainingRequest) {
// Inject style-post-loader before css-loader for scoped CSS and trimming // Inject style-post-loader before css-loader for scoped CSS and trimming
if (query.type === `style`) { if (query.type === `style`) {
const cssLoaderIndex = loaders.findIndex(l => /(\/|\\)css-loader/.test(l.path)) const cssLoaderIndex = loaders.findIndex(l => /(\/|\\|@)css-loader/.test(l.path))
if (cssLoaderIndex) { if (cssLoaderIndex > -1) {
const afterLoaders = loaders.slice(0, cssLoaderIndex + 1) const afterLoaders = loaders.slice(0, cssLoaderIndex + 1)
const beforeLoaders = loaders.slice(cssLoaderIndex + 1) const beforeLoaders = loaders.slice(cssLoaderIndex + 1)
const request = genRequest([ const request = genRequest([
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment