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.

Hi James 😃

I just upgraded to the glorious new syntax

const UniversalComponent = universal(
  ({ page }) => import(`../../pages/${page}`),
  {
    minDelay: 500,
    loading: PageSpinner,
    error: NotFound
  }
)

Unfortunately I’m running into a weird issue with chunk names which causes this:

image

The issue seems to be that webpack generates weird chunk names probably because of some hardcoded default value somewhere:

image

After switching back to the old, boring and verbose syntax:

const UniversalComponent = ({ page, isLoading }: Props) => {
  const Component = components[page] || NotFound
  return <Component isLoading={isLoading} />
}

const components = {
  Overview: universal(() => import('../../pages/Overview'), {
    minDelay: 500,
    loading: PageSpinner
  }),
  Invest: universal(() => import('../../pages/Invest'), {
    minDelay: 500,
    loading: PageSpinner
  }),
  Portfolio: universal(() => import('../../pages/Portfolio'), {
    minDelay: 500,
    loading: PageSpinner
  }),
  NotFound
}

…it works fine again and webpack generates correct chunk names:

image

I’m 90% sure the issue is that my folder structure is:

- components
    - Overview
        - index.js
        - styles.css

and I guess you are expecting:

- components
    - Overview.js

I’ve tried various paths in the universal component, e.g.:

  • import(`../../pages/${page}`)
  • import(`../../pages/${page}/index`)
  • import(`../../pages/${page}/index.js`)

But none seem to work.

Any idea what might go wrong here and whether react-universal-component or webpack-flush-chunks is to blame?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
chapati23commented, Aug 26, 2017
0reactions
faceyspaceycommented, Aug 18, 2017

Yea create an issue. They should know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extractor gets incorrect chunk name · Issue #216 - GitHub
My chunks come out named numerically, e.g. 0.chunk.js , 1.chunk.js and so on. This appears to be correctly output in loadable-stats.json ...
Read more >
How to correctly name the chunk group in Webpack?
namedChunkGroups and do something with them, but I've run into a bit of an issue: only my entrypoint results in a named chunk....
Read more >
SplitChunksPlugin - webpack
Controls which modules are selected by this cache group. Omitting it selects all modules. It can match the absolute module resource path or...
Read more >
How to Solve the Chunk Load Error in JavaScript - Rollbar
Whenever there's an error observed in dynamically fetching helper JavaScript files known as Chunks, a ChunkLoad Error is thrown.
Read more >
16 Common Problems with R Markdown (and some solutions)
16.3 “Duplication”: Duplicated chunk names ... The important part to note is the start: . . . Error in parse_block(g[-1], g[1], params.src) :...
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