Skip to content

Commit

Permalink
fix: skip matching rule with 'enforce'
Browse files Browse the repository at this point in the history
backports #1680
  • Loading branch information
sodatea committed Jun 23, 2020
1 parent e081dc4 commit e7b2b11
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/plugin-webpack5.js
Expand Up @@ -38,6 +38,10 @@ class VueLoaderPlugin {
let vueRules = []

for (const rawRule of rules) {
// skip rules with 'enforce'. eg. rule for eslint-loader
if (rawRule.enforce) {
continue
}
// skip the `include` check when locating the vue rule
const clonedRawRule = Object.assign({}, rawRule)
delete clonedRawRule.include
Expand Down
14 changes: 14 additions & 0 deletions test/advanced.spec.js
Expand Up @@ -241,6 +241,20 @@ test('support rules with oneOf', async () => {
})
})

test('should work with eslint loader', async () => {
// TODO:
return new Promise(resolve => {
bundle({
entry: 'basic.vue',
modify: config => {
config.module.rules.unshift({
test: /\.vue$/, loader: 'vue-loader', enforce: 'pre'
})
}
}, () => resolve())
})
})

// TODO
// test('multiple rule definitions', done => {
// mockBundleAndRun({
Expand Down

0 comments on commit e7b2b11

Please sign in to comment.