Commit 32c855c6 authored by Mike Greiling's avatar Mike Greiling

Remove echarts from the main bundle

parent 596f481e
import Vue from 'vue';
import EmbedGroup from '~/monitoring/components/embeds/embed_group.vue';
import { createStore } from '~/monitoring/stores/embed_group/';
// TODO: Handle copy-pasting - https://gitlab.com/gitlab-org/gitlab-foss/issues/64369.
......@@ -8,8 +7,6 @@ export default function renderMetrics(elements) {
return;
}
const EmbedGroupComponent = Vue.extend(EmbedGroup);
const wrapperList = [];
elements.forEach(element => {
......@@ -31,14 +28,24 @@ export default function renderMetrics(elements) {
element.parentNode.removeChild(element);
});
wrapperList.forEach(wrapper => {
// eslint-disable-next-line no-new
new EmbedGroupComponent({
el: wrapper,
store: createStore(),
propsData: {
urls: wrapper.urls,
},
});
});
if (wrapperList.length) {
import(/* webpackChunkName: 'gfm_metrics' */ '~/monitoring/components/embeds/embed_group.vue')
.then(EmbedGroup => {
const EmbedGroupComponent = Vue.extend(EmbedGroup);
wrapperList.forEach(wrapper => {
// eslint-disable-next-line no-new
new EmbedGroupComponent({
el: wrapper,
store: createStore(),
propsData: {
urls: wrapper.urls,
},
});
});
})
.catch(() => {
// do nothing
});
}
}
......@@ -268,6 +268,22 @@ module.exports = {
minChunks: 2,
reuseExistingChunk: true,
},
echarts: {
priority: 14,
name: 'echarts',
chunks: 'all',
test: /[\\/]node_modules[\\/](echarts|zrender)[\\/]/,
minChunks: 2,
reuseExistingChunk: true,
},
security_reports: {
priority: 13,
name: 'security_reports',
chunks: 'initial',
test: /[\\/](vue_shared[\\/](security_reports|license_compliance)|security_dashboard)[\\/]/,
minChunks: 2,
reuseExistingChunk: true,
},
vendors: {
priority: 10,
chunks: 'async',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment