After embedding a VueJs application into an existing site with its own set of JavaScript libraries, I encountered an issue. The runtime chunk in my application is calling the existing scripts from the site, resulting in multiple event listeners being added to a button instead of just one.
This is the content of vue.config.js:
module.exports = {
publicPath: '/b2b_platform/',
runtimeCompiler: true,
configureWebpack: {
optimization: {
runtimeChunk: { name: 'runtime' },
splitChunks: {
cacheGroups: {
'runtime-vendor': {
chunks: 'all',
name: 'vendors-node',
test: path.join(__dirname, 'node_modules')
}
},
minSize: 0
}
},
...
The runtime script causing the issue is as follows:
(function (e) {
// Code for the runtime script
})([]);
//# sourceMappingURL=runtime.js.map
Removing the function t() resolves the issue, but I'm unsure how to fix it permanently.