I'm using stealthy-require to reload React components for server-side rendering. One of their dependencies, namely react-helmet should not be reloaded.
My current workaround is:
const stealthyRequire = require('stealthy-require')
const helmetModule = require.cache[require.resolve('react-helmet')]
const loadView = name => () => stealthyRequire(require.cache, () => {
require.cache[helmetModule.id] = helmetModule
return getUniversalView(name)
})
It'd be neat if stealthyRequire would take IDs that should not be cleared. Perhaps:
stealthyRequire({
cache: require.cache,
keep: [require.resolve('react-helmet')]
}, () => {})
I'm using
stealthy-requireto reload React components for server-side rendering. One of their dependencies, namelyreact-helmetshould not be reloaded.My current workaround is:
It'd be neat if
stealthyRequirewould take IDs that should not be cleared. Perhaps: