Open chapati23 opened 6 years ago
Any updates on this one? I am experiencing the same issue.
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:
const UniversalComponent = universal(
({ page }) => import(`../../pages/${page}`),
{
minDelay: 500,
loading: PageSpinner,
error: NotFound
}
)
ContextReplacementPlugin
the way described by @joaovieira in https://github.com/faceyspacey/react-universal-component/issues/33#issuecomment-365310475.My current folder structure can be described as:
/pages/${pageName}/index.js
/pages/${pageName}/components/${componentName}/index.js
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?
im staying out of babel 7 until its past beta, and fully launched and settled.
Any update on this? I could not get the above code working in my project.
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?