Nested ChunkNames report a non-existent chunkname
See original GitHub issueHey James.
Pretty much the same issue i patched in the babel loader around nested chunknames.
This one was interesting, but logical. Before (in the babel-plugin) I was testing against an import(‘…/something/somethingelse’) Which works perfectly because ive got a path to correct.
Im currently building a rudimentary way for developers to render components in various folders (lets assume we have a relatively simple app and react routing isnt used).
localhost:3000/component/NestedComponent/SomeComponent
I match that to a route of component/*:componentName
What i end up with is passing this.props.route
to the my “UniversalComponent” (not to confuse you, ive placed it below)
// needs error handling
const determineHowToLoad = (props) => {
const resolver = (typeof props.component !== 'string') ? props.component() : import(`./${props.component}`);
return resolver
}
export const UniversalComponent = universal(determineHowToLoad, {
onError: (error, {isServer}) => { // eslint-disable-line no-unused-vars
throw error;
},
loading: () => null,
error: (e) => {
console.error(e); // eslint-disable-line no-console
return <div/>;
}
});
In the issue im opening, the component is being used like this (just to test)
<UniversalComponent userId={user.id} component="NestedExample/NestedComponent"/>
Which is essentially the same as
<UniversalComponent userId={user.id} component={this.props.route}/>
I was using my master branch of the babel plugin, which hadn’t yet been updated with your upstream repo. So it immediately didn’t work, after pulling from upstream (you) and restarting my server. I got that error about no chunk with this name found and it showed me Something/SomethingElse
. However, strangely enough, the component was able to load. It just did a strange flash and i also got a checksum warning about the client server output.
I pulled this repo and went on an investigation, and it looks like, because its a fully dynamic component no path gets generated correctly. when the HOC runs the chunkname
function.
Looks like the culprit is const chunkName = addModule(this.props)
Ive not yet started to look into this, but ill try and open a PR this week, as well as investigate the folder flattening reported
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
Sounds good. If you could help me with the rollback and major version bump for the recent PR that would be great. Still waiting on NPM to approve the version unpublishing.
Pretty much! With webpack 4 upgrades