Question: res.locals
kahurangitama opened this issue · comments
Hi! First of all I would thank you for this project, its truly awesome!
Recently I moved to @loadable/component + ssr. But still can't understand one thing in your code:
There is res.locals.assetPath
function there. But I can't realize where it appear from? If I do console.log I'll get another functions which I suggest related to chunk extractor or something like that. But I wan't keep my res.locals clean. How can I remove it?
{
user: null // passportjs
store: {...}, // it's store
history: {...}, // it's history
...
// where next func came from?
getSources: [Function: getSources],
getStylesheetSources: [Function: getStylesheetSources],
getStylesheets: [Function: getStylesheets],
getJavascriptSources: [Function: getJavascriptSources],
getJavascripts: [Function: getJavascripts],
getImageSources: [Function: getImageSources],
getImages: [Function: getImages],
getManifest: [Function: getManifest],
assetPath: [Function: assetPath],
imageTag: [Function: imageTag],
javascriptTag: [Function: javascriptTag],
stylesheetTag: [Function: stylesheetTag] }
Search trough project didn't found anything
It’s coming from this plugin/middleware:
https://github.com/danethurber/express-manifest-helpers/blob/master/README.md#helpers
It’s reading the manifest file created by webpack-manifest-plugin in config/webpack.config.js/plugins.js
Used here:
react-ssr-setup/src/server/index.ts
Lines 46 to 50 in e132ac9
Thank you for response! I asked because suddenly assetPath() started to return an empty string and I trying to figure out what I did wrong. Thanks again!
That sometimes happens if there were problems writing the manifest.json. It usually helps to restart the yarn start
process.