💬 Questions and Help
Hi there, I am now using new ChunkExtractor() outside of the main app.use() or app.get('*') on my server side.
It works fine you can checkout this link on my repo react-easy-ssr
I am doing like this
const app = express()
const extractor = new ChunkExtractor({
statsFile: path.join(paths.clientBuild, paths.publicPath, 'loadable-stats.json'),
entrypoints: ['bundle']
})
indexRoutes.forEach((indexRoute) => indexRoute.Component.preload()) // avoid side effect due to split code on server side
app.use(async (req: Request, res: Response) => { ... })
My question is why in all the examples given by loadable-components you haven't been doing this ?
In all your examples, you consistently use this approach :
const server = express()
server
.disable('x-powered-by')
.use(express.static(process.env.RAZZLE_PUBLIC_DIR))
.get('/*', (req, res) => {
const extractor = new ChunkExtractor({
statsFile: path.resolve('build/loadable-stats.json'),
entrypoints: ['client'],
})
...
Actually this approch doesn't work with my nodemon config in development mode.
Thanks a lot, bye.
💬 Questions and Help
Hi there, I am now using
new ChunkExtractor()outside of the mainapp.use()orapp.get('*')on my server side.It works fine you can checkout this link on my repo
react-easy-ssrI am doing like this
My question is why in all the examples given by
loadable-componentsyou haven't been doing this ?In all your examples, you consistently use this approach :
Actually this approch doesn't work with my
nodemonconfig in development mode.Thanks a lot, bye.