@@ -68,35 +68,28 @@ export default function normalizeComponent (
6868 // never gets called
6969 options . _ssrRegister = hook
7070 } else if ( injectStyles ) {
71- if ( shadowMode ) {
72- hook = function ( ) {
73- injectStyles ( this . $root . $options . shadowRoot )
74- }
75- } else {
76- hook = injectStyles
77- }
71+ hook = shadowMode
72+ ? function ( ) { injectStyles ( this . $root . $options . shadowRoot ) }
73+ : injectStyles
7874 }
7975
8076 if ( hook ) {
81- var functional = options . functional
82- var existing = functional
83- ? options . render
84- : options . beforeCreate
85-
86- if ( ! functional ) {
87- // inject component registration as beforeCreate hook
88- options . beforeCreate = existing
89- ? [ ] . concat ( existing , hook )
90- : [ hook ]
91- } else {
77+ if ( options . functional ) {
9278 // for template-only hot-reload because in that case the render fn doesn't
9379 // go through the normalizer
9480 options . _injectStyles = hook
9581 // register for functioal component in vue file
82+ var render = options . render
9683 options . render = function renderWithStyleInjection ( h , context ) {
9784 hook . call ( context )
98- return existing ( h , context )
85+ return render ( h , context )
9986 }
87+ } else {
88+ // inject component registration as beforeCreate hook
89+ var existing = options . beforeCreate
90+ options . beforeCreate = existing
91+ ? [ ] . concat ( existing , hook )
92+ : [ hook ]
10093 }
10194 }
10295
0 commit comments