@@ -8,6 +8,7 @@ const stylePostLoaderPath = require.resolve('./stylePostLoader')
88const isESLintLoader = l => / ( \/ | \\ | @ ) e s l i n t - l o a d e r / . test ( l . path )
99const isNullLoader = l => / ( \/ | \\ | @ ) n u l l - l o a d e r / . test ( l . path )
1010const isCSSLoader = l => / ( \/ | \\ | @ ) c s s - l o a d e r / . test ( l . path )
11+ const isCacheLoader = l => / ( \/ | \\ | @ ) c a c h e - l o a d e r / . test ( l . path )
1112const isPitcher = l => l . path !== __filename
1213
1314const dedupeESLintLoader = loaders => {
@@ -24,6 +25,23 @@ const dedupeESLintLoader = loaders => {
2425 return res
2526}
2627
28+ const shouldIgnoreCustomBlock = loaders => {
29+ const actualLoaders = loaders . filter ( loader => {
30+ // vue-loader
31+ if ( loader . path === selfPath ) {
32+ return false
33+ }
34+
35+ // cache-loader
36+ if ( isCacheLoader ( loader ) ) {
37+ return false
38+ }
39+
40+ return true
41+ } )
42+ return actualLoaders . length === 0
43+ }
44+
2745module . exports = code => code
2846
2947// This pitching loader is responsible for intercepting all vue block requests
@@ -128,11 +146,9 @@ module.exports.pitch = function (remainingRequest) {
128146 return `export * from ${ request } `
129147 }
130148
131- // if a custom block has no other matching loader other than vue-loader itself,
132- // we should ignore it
133- if ( query . type === `custom` &&
134- loaders . length === 1 &&
135- loaders [ 0 ] . path === selfPath ) {
149+ // if a custom block has no other matching loader other than vue-loader itself
150+ // or cache-loader, we should ignore it
151+ if ( query . type === `custom` && shouldIgnoreCustomBlock ( loaders ) ) {
136152 return ``
137153 }
138154
0 commit comments