Commit aa91b5eb authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch '246540-externalise-shortcuts-js-init' into 'master'

Code-Splitting of shortcuts.js for main.js reduction

Closes #246540

See merge request gitlab-org/gitlab!41694
parents 29ac2713 2d326d3f
import Shortcuts from './shortcuts/shortcuts';
export default function initPageShortcuts() {
const { page } = document.body.dataset;
const pagesWithCustomShortcuts = [
......@@ -29,7 +27,9 @@ export default function initPageShortcuts() {
// the pages above have their own shortcuts sub-classes instantiated elsewhere
// TODO: replace this whitelist with something more automated/maintainable
if (page && !pagesWithCustomShortcuts.includes(page)) {
return new Shortcuts();
import(/* webpackChunkName: 'shortcutsBundle' */ './shortcuts/shortcuts')
.then(({ default: Shortcuts }) => new Shortcuts())
.catch(() => {});
}
return false;
}
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