question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[vue-server-renderer] Bug failing when using a reference of process - related to SSRClientWebpackPlugin

See original GitHub issue

Version

2.5.21

Reproduction link

https://github.com/AlexandreBonaventure/repro-vue-ssr-bug

Steps to reproduce

  1. yarn install
  2. yarn run ssr:build && yarn ssr:start
  3. go to localhost:8000

What is expected?

to serve / correctly

What is actually happening?

error 500:

TypeError: Cannot read property 'replace' of undefined
    at normalizeFile (.../node_modules/vue-server-renderer/build.js:8183:27)

Hi, I came across this weird bug when I was trying to retrieve a global variable (eg. global.localenv.PUBLIC_URL) in App.vue to populate a meta tag (using vue-meta). I stumble upon the bug, and narrowed it down to referencing process being the cause here. Another weird thing is that if you remove the component Icons import in the minimal repro, it works fine!

The error stack is initiated by TemplateRenderer.renderPreloadLinks which makes me think that maybe it is a bug in the webpack SSRClientPlugin which inject preload links for every assets.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:10

github_iconTop GitHub Comments

9reactions
laure-at-iruncommented, Mar 18, 2019

For me, the error was caused by a malformed vue-ssr-client-manifest.json : in the modules section, some modules were mapped to indexes -1. As a result, at runtime, the vue-server-renderer was unable to load the file.

To fix it, I just enabled the source maps for css files. In vue.config.js, add to your client config :

css: {
     sourceMap: true,
},

Tested with version 2.6.9.

I hope this will help.

1reaction
tkjaergaardcommented, Dec 18, 2018

+1

I’m experiencing the same issue TypeError: Cannot read property 'replace' of undefined.

Downgrading to vue@2.5.17, vue-server-renderer@2.5.17 and vue-template-compiler@2.5.17 made my application run again.

2.5.18-2.5.21 make my application break with the TypeError:

TypeError: Cannot read property 'replace' of undefined
    at normalizeFile (.../node_modules/vue-server-renderer/build.js:8176:27)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Vuejs 2 Server side rendering - not working
I've been working on making my vuejs app function well with SSR but all of my tries failed. I really need help in...
Read more >
vue-server-renderer
Start using vue-server-renderer in your project by running `npm i vue-server-renderer`. There are 506 other projects in the npm registry ...
Read more >
@vue/server-renderer | Yarn - Package Manager
... you no longer need to explicitly install this package and ensure its version match that of vue 's. Just use the vue/server-renderer...
Read more >
API Reference | Vue SSR Guide
Create a BundleRenderer instance with a server bundle and (optional) options. const { createBundleRenderer } = require('vue-server-renderer') const renderer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found