i am trying to split a code in chunks and i face an issue. I have a script like
import Component1 from 'Libs/component1';
import Component2 from 'Libs/component2';
import Component3 from 'Integrations/component3';
window.myComponent1 = new Component1();
window.myComponent2 = new Component2();
window.myComponent3 = new Component3;
The above window.myComponent statements are executed normally and the objects are globally accessible when i dont use the splitChunks. If add the below config on the webpack
optimization: {
splitChunks: {
chunks: 'all'
}
}
The the window.myComponent statements are never executed, if i check the created bundles the code is there but never executed. Why ? What i am doing wrong ?