Chunk Name Issue
See original GitHub issueHi 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:
The issue seems to be that webpack generates weird chunk names probably because of some hardcoded default value somewhere:
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:
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:
- Created 6 years ago
- Comments:12 (9 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
➡️ https://github.com/webpack/webpack/issues/5575
Yea create an issue. They should know.