New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using experimentalOptimizeChunks
with static and dynamic imports of the same file
#3340
Comments
Thank you for taking the time to create this issue. Unfortunately, It will most likely make a reappearance as a plugin in the future once the necessary changes and APIs have been created. |
@lukastaegert don't do that let it stay its flaged experimental but it is usefull! i know that it comes from ember but still userfull don't remove else i need to fork i don't want that! |
But you are aware that it is broken as you can see above? And it is really hard to fix and maintain because it basically tries to incompletely replicate some logic without any connection to that logic. I would be interested to hear what the situation is that you are trying to improve with this feature. Also note that #3305 will land when this feature is removed, which can already noticeably decrease the number of chunks created by dynamic imports. There is another feature planned that will decrease the number of chunks created by static entry points by specifying that some entry points are always loaded before other entry points are loaded. And of course there is |
@lukastaegert i am well aware of this but let me show you a good example that it can get used this is a working workaround for the most bugs of it const rollup = require('../rollup');
rollup.rollup({
experimentalCodeSplitting: true,
optimizeChunks: true,
input: ['main1.js', 'main2.js', 'main3.js']
}).then(build => {
return build.generate({ format: 'amd' })
.then(generated => {
return build.generate({ format: 'amd' });
});
}).then(generated => {
console.log(generated);
})
.catch(e => {
console.log(e);
}) this does exactly what you want to do in the new implamentation it moves it to the end of the generate phase. |
This is not what I mean. The chunking still happens in the I'm not sure what calling Also, |
hmm maybe your right and the functionality can be added via hooks anyway so the feature is not needed in the core project |
Closed in rollup@2.0.0 |
How Do We Reproduce?
Code REPL
Setting
experimentalOptimizeChunks
to true produces the followingentry1.js
entry2.js
asyncEntry-3be3e543.js
asyncEntry-be86dbf9.js
Expected Behavior
The
entry1.js
file should async requireasyncEntry.js
, andentry2.js
should statically requireasyncEntry.js
.Actual Behavior
In
entry2.js
, the static require statement forasyncEntry.js
is completely missing. The identifier forasyncEntry
is still used in the code but without the require statment it's resolving to a global that doesn't exist.The text was updated successfully, but these errors were encountered: