Hello, I would like help with a strange behavior that is happening in an application.
The main application makes use of 2 web components, each of which comes from external applications. The external applications are "academic services" and "messages".
When I access the page in the main application, which will load the web component of the "academic services" application, everything works perfectly. See the print of the loaded scripts:
So when I navigate to the "messages" page, the scripts seems to be partially loaded and I get this error in the console:
Notice that only chunk "5" was loaded. Now, if I reload this page, all chunks are loaded and everything works perfectly:
I tested several configurations (use of hashes in chunks, disabled polyfill, etc.) but nothing seems to work. The impression is that it is reusing previously downloaded chunks (As it only downloaded chunk 5. After the refresh, all chunks are downloaded).
This is the "academic services" configuration:
customElements: {
buildDir : 'dist/web-components',
entries : [
{
name: 'default',
webpackExtend(config) {
config.output = {
...config.output,
publicPath : 'publicPathPlaceholder',
filename : `[name].academic-services.js`,
chunkFilename : '[name].[hash].js'
};
config.plugins = [
...config.plugins,
new (require('webpack-dynamic-public-path'))({
externalPublicPath: `window.acedemicServicesCustomPublicPath`
})
];
},
tags: [
{
name : 'WcMainAs',
path : '@/entries/default/main-as',
async : true,
options() {
return {
props : ['token'],
destroyTimeout : null,
vueInstanceCreatedCallback() {
window.dispatchEvent(new CustomEvent('wcVueInstanceCreated'));
}
};
}
}
]
}
]
}
And this one is from "messages":
customElements: {
buildDir : 'dist/web-components',
entries : [
{
name: 'default',
webpackExtend(config) {
config.output = {
...config.output,
publicPath : 'publicPathPlaceholder',
filename : `[name].messages.js`,
chunkFilename : '[name].[hash].js'
};
config.plugins = [
...config.plugins,
new (require('webpack-dynamic-public-path'))({
externalPublicPath: `window.messagesCustomPublicPath`
})
];
},
tags: [
{
name : 'WcMainMs',
path : '@/entries/default/mainMs',
async : true,
options() {
return {
props : ['token'],
destroyTimeout : null,
vueInstanceCreatedCallback() {
window.dispatchEvent(new CustomEvent('wcVueInstanceCreated'));
}
};
}
}
]
}
]
}
Any suggestion is welcome, and thanks again 😄