react-universal-component: chunk not available for synchronous require yet
When I try to set webpackChunkName
in import()
, I get this in linux console:
trace (Click to show)
chunk not available for synchronous require yet: /components/Home: Cannot find module '/components/Home' Error: Cannot find module '/components/Home'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at requireById (/home/anton/Documents/workspace-sts/nodejs-spring-cloud-app-boilerplate/node_modules/react-universal-component/dist/utils.js:59:19)
at tryRequire (/home/anton/Documents/workspace-sts/nodejs-spring-cloud-app-boilerplate/node_modules/react-universal-component/dist/utils.js:45:12)
at requireSync (/home/anton/Documents/workspace-sts/nodejs-spring-cloud-app-boilerplate/node_modules/react-universal-component/dist/requireUniversalModule.js:42:37)
at UniversalComponent.componentWillMount (/home/anton/Documents/workspace-sts/nodejs-spring-cloud-app-boilerplate/node_modules/react-universal-component/dist/index.js:193:23)
at processChild (/home/anton/Documents/workspace-sts/nodejs-spring-cloud-app-boilerplate/node_modules/react-dom/cjs/react-dom-server.node.development.js:2167:16)
at resolve (/home/anton/Documents/workspace-sts/nodejs-spring-cloud-app-boilerplate/node_modules/react-dom/cjs/react-dom-server.node.development.js:2061:5)
at ReactDOMServerRenderer.render (/home/anton/Documents/workspace-sts/nodejs-spring-cloud-app-boilerplate/node_modules/react-dom/cjs/react-dom-server.node.development.js:2380:22)
and shows an error `error: serverRenderer is not a function`.
If I do not try to change chunk name, it works, but the error is showed in console anyway.
specs:
- “webpack”: “^4.12.0”,
- “webpack-hot-server-middleware”: “^0.5.0”,
- “babel-plugin-universal-import”: “faceyspacey/babel-plugin-universal-import#webpack-4”,
- “webpack-flush-chunks”: “^2.0.1-beta.1”
And most interesting is: when I start dev server whithout commented webpackChunkName
instruction, but change them on the fly, without restart server (HMR works), no errors shows in browser, only console always contains that error. In any case.
May be, my server setup has smth wrong…
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 32 (1 by maintainers)
Hmmm @rherwig If you are not able to then I’m inclined to dedicate my efforts into other areas of this project in desperate need of upgrades. One being a been call to developers who want to help us out with getting an alpha release of Rudy #justSaying
@rherwig ahh thank you, its could likely by a yarn.lock or package-lock.json file messing with him?
I discovered a few React-Static issues related to that
Half way there man, 2 more days 😂
So I had this issue as well. What I did was create like a utility component. Essentially, a workaround is instead of using universal HOC on many pages, create another JSX file that accepts a prop. Then, use ignore-loader so that it’s not bundled in.
I’ll be able to look closer at this once I’m set Up. Again sorry for such delays