-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Lazy loading and code splitting #1802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
53f1c59
d9be469
3227d5b
e8cda17
e6098fb
2543cd0
ad42c10
55776a3
1e15296
8156b79
f0ff09f
4f651ff
c54c079
1f860fd
6823ec3
a506aec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| /* stylelint-disable custom-property-empty-line-before */ | ||
| /* stylelint-disable alpha-value-notation */ | ||
| .dh-spectrum-alias { | ||
|
|
||
| /** | ||
| * Intentionally using the classname twice so we have higher specificity than spectrum's definitions | ||
| */ | ||
|
Comment on lines
+4
to
+7
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we doing this and why is it a part of this change? Should add to the comment why we need to do this (chunks loading out of order). Though that being said - chunks loading out of order implies there's something off with the packaging. Why is this happening now?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll update the comment. I didn't dig too far into why the chunks were out of order (we don't directly import spectrum's css nor can we because it's spread across every component). We could also have an import order wrong somewhere in our code. Or because of lazy loading the chunks are getting split a little differently. We still put node_modules into 1 of 4 chunks (monaco, plotly, mathjax, vendor). Everything else seems to chunk based on the dynamic imports. Either way, just increasing the specificity is safer in the long run I think (although it did fail e2e tests because of the import order) |
||
| .dh-spectrum-alias.dh-spectrum-alias { | ||
| /*********** Override variables in spectrum-global.css **********************/ | ||
| --spectrum-alias-background-color-default: var(--dh-color-bg); | ||
| --spectrum-alias-background-color-disabled: var(--dh-color-disabled-bg); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| test('does not load heavy dependencies by default', async ({ page }) => { | ||
|
mattrunyon marked this conversation as resolved.
Outdated
|
||
| page.on('request', request => { | ||
| expect(request.url()).not.toMatch('assets/plotly'); | ||
| expect(request.url()).not.toMatch('assets/mathjax'); | ||
| }); | ||
| await page.goto(''); | ||
| await expect(page.locator('.loading-spinner')).toHaveCount(0); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.