Skip to content

Commit

Permalink
fix: compat with null-loader (close #1239)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 24, 2018
1 parent a3af6b3 commit 5cd5f6f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/loaders/pitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports.pitch = function (remainingRequest) {
const query = qs.parse(this.resourceQuery.slice(1))
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))) {
return
}

// loader.request contains both the resolved loader path and its options
// query (e.g. ??ref-0)
const toLoaderString = loader => loader.request
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"mini-css-extract-plugin": "^0.2.0",
"node-sass": "^4.7.2",
"normalize-newline": "^3.0.0",
"null-loader": "^0.1.1",
"postcss-loader": "^2.1.2",
"pug": "^2.0.1",
"pug-plain-loader": "^1.0.0",
Expand Down
14 changes: 14 additions & 0 deletions test/edgeCases.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,17 @@ test('html-webpack-plugin', done => {
done()
}, true)
})

test('usage with null-loader', done => {
mockBundleAndRun({
entry: 'basic.vue',
modify: config => {
config.module.rules[1] = {
test: /\.css$/,
use: ['null-loader']
}
}
}, ({ window, exports, code }) => {
done()
})
})
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5781,6 +5781,10 @@ nth-check@~1.0.1:
dependencies:
boolbase "~1.0.0"

null-loader@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/null-loader/-/null-loader-0.1.1.tgz#17be9abfcd3ff0e1512f6fc4afcb1f5039378fae"

num2fraction@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede"
Expand Down

0 comments on commit 5cd5f6f

Please sign in to comment.