Skip to content

Commit 8eb32b0

Browse files
committed
refactor: update entrypoint to async load new web components; update load order to account for the styleguide.js logic being sensitive to the order that things load in
1 parent 40a6bcd commit 8eb32b0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/uikit-workshop/src/scripts/patternlab-viewer.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1+
import { loadPolyfills } from './utils/polyfills';
2+
3+
loadPolyfills.then(res => {
4+
import(/* webpackMode: 'eager', webpackChunkName: 'pl-layout' */ './components/pl-layout/pl-layout').then(
5+
() => {
6+
// this ensures that the old-school way the styleguide JS binds to the page isn't thrown off by the <pl-layout> component rendering -- temp workaround till the logic in styleguide.js gets broken down and refactored.
7+
import(/* webpackMode: 'eager', webpackChunkName: 'pl-styleguide' */ './components/styleguide');
8+
}
9+
);
10+
import(/* webpackMode: 'eager', webpackChunkName: 'pl-toggle-theme' */ './components/pl-toggle-theme/pl-toggle-theme');
11+
import(/* webpackMode: 'eager', webpackChunkName: 'pl-toggle-layout' */ './components/pl-toggle-layout/pl-toggle-layout');
12+
});
13+
114
import './components/typeahead';
2-
import './components/layout';
315
import './components/modal-viewer';
416
import './components/panels';
517
import './components/panels-viewer';
618
import './components/pattern-finder';
719
import './components/plugin-loader';
8-
import './components/styleguide';
920

1021
//// Add hook to auto re-render the root component.
1122
if (typeof module.hot === 'object') {

0 commit comments

Comments
 (0)