webpack-encore icon indicating copy to clipboard operation
webpack-encore copied to clipboard

Code splitting of nested routes for each entry point

Open abhinav-sendinblue opened this issue 6 years ago • 1 comments

Let me share an example to explain my problem:-

I have 3 entry points:-

.addEntry('one', './assets/one/app.js') .addEntry('two', './assets/two/app.js') .addEntry('three', './assets/three/app.js')

Now all these entry points are separate react apps and they have their owned nested route like:-

<Route exact path="/one/1" component={Home} />
<Route exact path="/one/2" component={otherComponent} />

Same goes for other two entry points:-

<Route exact path="/two/1" component={Home} />
<Route exact path="/two/2" component={otherComponent} />

Now lets says for entry one when I hit

/one/1

or

/one/2

for both there is only one bundle one.js is being loaded.

I wanted to further split my chunks as per my nested routes. By using dynamic imports and React Loadable I am able to split chunks:-

one.js 
0.js
1.js

but these are being loaded together. All three no matter you hit /one/1 or /one/2.

Originally posted by @abhinav-sendinblue in https://github.com/symfony/webpack-encore/issues/573#issuecomment-538386160

abhinav-sendinblue avatar Oct 05 '19 14:10 abhinav-sendinblue

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot avatar Feb 02 '25 12:02 carsonbot

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot avatar Aug 03 '25 12:08 carsonbot

Could I get a reply or should I close this?

carsonbot avatar Aug 17 '25 12:08 carsonbot

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

carsonbot avatar Aug 31 '25 12:08 carsonbot