You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey man,
been playing around with babel7 in this repo some more and ran into an issue that we had solved already. Could be an error with babel-plugin-universal-import (?)
See the below exception of ReferenceError: _universalImport is not defined :-/
Description
Refresher
Your file structure:
- components/
- PageName.js
My file structure:
- components/
- PageName/
- index.js
Working in Babel 6
When using your dynamic import for the UniversalComponent there is this annoying webpack chunk issue that I'm currently working around by using a hash map for my UniversalComponent:
You can see that approach working fine in this branch that runs babel6 with my file structure.
Failing in Babel 7
Same code, only difference now I'm on babel 7 and I get an error, full stack trace:
ReferenceError: _universalImport is not defined
at eval (webpack:///./src/components/UniversalComponent.js?:55:5)
at getConfig (webpack:///./node_modules/react-universal-component/dist/requireUniversalModule.js?:160:52)
at requireUniversalModule (webpack:///./node_modules/react-universal-component/dist/requireUniversalModule.js?:25:16)
at UniversalComponent.componentWillMount (webpack:///./node_modules/react-universal-component/dist/index.js?:155:58)
at resolve (webpack:///./node_modules/react-dom/cjs/react-dom-server.node.development.js?:2119:12)
at ReactDOMServerRenderer.render (webpack:///./node_modules/react-dom/cjs/react-dom-server.node.development.js?:2260:22)
at ReactDOMServerRenderer.read (webpack:///./node_modules/react-dom/cjs/react-dom-server.node.development.js?:2234:19)
at Object.renderToString (webpack:///./node_modules/react-dom/cjs/react-dom-server.node.development.js?:2501:25)
at _callee$ (webpack:///./server/render.js?:61:45)
at tryCatch (/Users/chapati/projects/open-source/redux-first-router-demo/node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (/Users/chapati/projects/open-source/redux-first-router-demo/node_modules/regenerator-runtime/runtime.js:296:22)
at Generator.prototype.(anonymous function) [as next] (/Users/chapati/projects/open-source/redux-first-router-demo/node_modules/regenerator-runtime/runtime.js:114:21)
at step (webpack:///./server/render.js?:28:221)
at _next (webpack:///./server/render.js?:28:409)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7) ReferenceError: _universalImport is not defined
at eval (webpack:///./src/components/UniversalComponent.js?:55:5)
at getConfig (webpack:///./node_modules/react-universal-component/dist/requireUniversalModule.js?:160:52)
at requireUniversalModule (webpack:///./node_modules/react-universal-component/dist/requireUniversalModule.js?:25:16)
at UniversalComponent.componentWillMount (webpack:///./node_modules/react-universal-component/dist/index.js?:155:58)
at resolve (webpack:///./node_modules/react-dom/cjs/react-dom-server.node.development.js?:2119:12)
at ReactDOMServerRenderer.render (webpack:///./node_modules/react-dom/cjs/react-dom-server.node.development.js?:2260:22)
at ReactDOMServerRenderer.read (webpack:///./node_modules/react-dom/cjs/react-dom-server.node.development.js?:2234:19)
at Object.renderToString (webpack:///./node_modules/react-dom/cjs/react-dom-server.node.development.js?:2501:25)
at _callee$ (webpack:///./server/render.js?:61:45)
at tryCatch (/Users/chapati/projects/open-source/redux-first-router-demo/node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (/Users/chapati/projects/open-source/redux-first-router-demo/node_modules/regenerator-runtime/runtime.js:296:22)
at Generator.prototype.(anonymous function) [as next] (/Users/chapati/projects/open-source/redux-first-router-demo/node_modules/regenerator-runtime/runtime.js:114:21)
at step (webpack:///./server/render.js?:28:221)
at _next (webpack:///./server/render.js?:28:409)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
=================
Any ideas?
The text was updated successfully, but these errors were encountered:
chapati23
changed the title
babel7 causes ./pages/PageName/index.js file structure to fail: "ReferenceError: _universalImport is not defined"
babel7 causes UniversalComponent to fail when using a hash table instead of dynamic imports: "ReferenceError: _universalImport is not defined"
Feb 20, 2018
Okay, for people who faced this issue by trying to update to Babel 7 while using hash map for routes. I managed to solve the issue by following these steps:
I suppose there is a better way to solve the issue with unnecessarily generated chunks by changing the folder structure rather than using ContextReplacementPlugin, however, I have not managed to make it work. @faceyspacey, what exactly I need to change in my current folder structure to make it work?
Hey man,
been playing around with babel7 in this repo some more and ran into an issue that we had solved already. Could be an error with
babel-plugin-universal-import
(?)How to reproduce
yarn start
yarn start
ReferenceError: _universalImport is not defined
:-/Description
Refresher
Your file structure:
My file structure:
Working in Babel 6
When using your dynamic import for the
UniversalComponent
there is this annoying webpack chunk issue that I'm currently working around by using a hash map for myUniversalComponent
:You can see that approach working fine in this branch that runs babel6 with my file structure.
Failing in Babel 7
Same code, only difference now I'm on babel 7 and I get an error, full stack trace:
=================
Any ideas?
The text was updated successfully, but these errors were encountered: