Skip to content

Commit 2a247fc

Browse files
committed
fix ssr initial context style recording
1 parent 016920e commit 2a247fc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/server/bundle-renderer/create-bundle-runner.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isObject } from 'shared/util'
1+
import { isPlainObject } from 'shared/util'
22

33
const vm = require('vm')
44
const path = require('path')
@@ -73,7 +73,7 @@ function compileModule (files, basedir) {
7373
}
7474

7575
function deepClone (val) {
76-
if (isObject(val)) {
76+
if (isPlainObject(val)) {
7777
const res = {}
7878
for (const key in val) {
7979
res[key] = deepClone(val[key])
@@ -108,14 +108,13 @@ export function createBundleRunner (entry, files, basedir, runInNewContext) {
108108
const initialContext = {}
109109
const sharedContext = createContext(initialContext)
110110

111-
// On subsequent renders, __VUE_SSR_CONTEXT__ will not be avaialbe
112-
// to prevent cross-request pollution.
113-
delete sharedContext.__VUE_SSR_CONTEXT__
114-
115111
let runner // lazy creation so that errors can be caught by user
116112
return (userContext = {}) => new Promise(resolve => {
117113
if (!runner) {
118114
runner = evaluate(entry, sharedContext)
115+
// On subsequent renders, __VUE_SSR_CONTEXT__ will not be avaialbe
116+
// to prevent cross-request pollution.
117+
delete sharedContext.__VUE_SSR_CONTEXT__
119118
if (typeof runner !== 'function') {
120119
throw new Error(
121120
'bundle export should be a function when using ' +

0 commit comments

Comments
 (0)