@@ -32,6 +32,7 @@ var defaultLang = {
3232
3333module . exports = function ( content ) {
3434 this . cacheable ( )
35+ var isServer = this . options . target === 'node'
3536 var loaderContext = this
3637 var options = this . options . vue || { }
3738 var query = loaderUtils . parseQuery ( this . query )
@@ -133,17 +134,17 @@ module.exports = function (content) {
133134 }
134135
135136 var parts = parse ( content , fileName , this . sourceMap )
136- var hasScoped = false
137+ var hasScoped = parts . styles . some ( function ( s ) { return s . scoped } )
137138 var output = 'var __vue_script__\n'
138139
139140 // add requires for styles
140- parts . styles . forEach ( function ( style , i ) {
141- var scoped = style . scoped
142- if ( scoped ) hasScoped = true
143- output += style . src
144- ? getRequireForImport ( 'styles' , style , scoped )
145- : getRequire ( 'styles' , style , i , scoped )
146- } )
141+ if ( ! isServer ) {
142+ parts . styles . forEach ( function ( style , i ) {
143+ output += style . src
144+ ? getRequireForImport ( 'styles' , style , style . scoped )
145+ : getRequire ( 'styles' , style , i , style . scoped )
146+ } )
147+ }
147148
148149 // add require for script
149150 var script = parts . script
0 commit comments