question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested ChunkNames report a non-existent chunkname

See original GitHub issue

Hey 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:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
faceyspaceycommented, Apr 30, 2018

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.

0reactions
ScriptedAlchemycommented, Jun 6, 2018

Pretty much! With webpack 4 upgrades

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to generate dynamic import chunk name in Webpack
From webpack docs: webpackChunkName: A name for the new chunk. Since webpack 2.6.0, the placeholders [index] and [request] are supported ...
Read more >
eslint-plugin-import/dynamic-import-chunkname.md at main
This rule reports any dynamic imports without a webpackChunkName specified in a leading block comment in the proper format. This rule enforces naming...
Read more >
rollup changelog
Fix a situation where line-breaks in a nested simplified ... Render valid imports when chunk names correspond to directory names in virtual ...
Read more >
MNG (Multiple-image Network Graphics) Format Version 1.0
When a MNG datastream is stored in a file, it is recommended that ".mng" be used ... Loops must be properly nested: if...
Read more >
@netlify/esbuild-linux-64 | Yarn - Package Manager
This release fixes a bug where if a file name template has the [hash] placeholder (either --entry-names= or --chunk-names= ), the hash that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found