@@ -34,13 +34,28 @@ var defaultLang = {
3434 script : 'js'
3535}
3636
37+ // When extracting parts from the source vue file, we want to apply the
38+ // loaders chained before vue-loader, but exclude some loaders that simply
39+ // produces side effects such as linting. This is a hard-coded list and
40+ // hopefully eslint-loader is the only one.
41+ var excludedPreLoadersRE = / e s l i n t - l o a d e r /
42+
43+ function getRawRequest ( context ) {
44+ const clonedContext = Object . assign ( { } , context , {
45+ loaders : context . loaders . filter ( loader => ! excludedPreLoadersRE . test ( loader . path ) )
46+ } )
47+ delete clonedContext . remainingRequest
48+ return loaderUtils . getRemainingRequest ( clonedContext )
49+ }
50+
3751module . exports = function ( content ) {
3852 this . cacheable ( )
3953 var isServer = this . options . target === 'node'
4054 var isProduction = this . minimize || process . env . NODE_ENV === 'production'
4155
4256 var loaderContext = this
4357 var query = loaderUtils . parseQuery ( this . query )
58+ var rawRequest = getRawRequest ( this )
4459 var options = this . options . __vueOptions__ = Object . assign ( { } , this . options . vue , this . vue , query )
4560
4661 var filePath = this . resourcePath
@@ -85,7 +100,7 @@ module.exports = function (content) {
85100 // select the corresponding part from the vue file
86101 getSelectorString ( type , index || 0 ) +
87102 // the url to the actual vue file, including remaining requests
88- loaderUtils . getRemainingRequest ( loaderContext )
103+ rawRequest
89104 )
90105 }
91106
0 commit comments