[vue-server-renderer] Bug failing when using a reference of process - related to SSRClientWebpackPlugin
See original GitHub issueVersion
2.5.21
Reproduction link
https://github.com/AlexandreBonaventure/repro-vue-ssr-bug
Steps to reproduce
yarn install
yarn run ssr:build && yarn ssr:start
- 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:
- Created 5 years ago
- Reactions:1
- Comments:10
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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, thevue-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 :Tested with version 2.6.9.
I hope this will help.
+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
andvue-template-compiler@2.5.17
made my application run again.2.5.18
-2.5.21
make my application break with the TypeError: