Skip to content

compatibility problem of SSR with ES5 #3867

@speedornothing

Description

@speedornothing

bundle rendering doesn't work if exports a function using module.exports = function(context).. instead of export default context => ... in server entry point . it throws an error:

TypeError: Cannot read property 'render' of undefined
at normalizeRender (node_modules\vue-server-renderer\build.js:5192:19)

it looks like a compatibility problem of bundle rendering with ES5.

I changed the codes in node_modules/vue-server-renderer/build.js to the following:

if(typeof m.exports === 'function'){
  resolve(m.exports(_context))
  return
}

var res = Object.prototype.hasOwnProperty.call(m.exports, 'default')
  ? m.exports.default
  : m

then it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions