Skip to content
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

Use styleModule in prebuilt extensions #9460

Merged
merged 2 commits into from
Dec 14, 2020

Conversation

jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Dec 11, 2020

References

Fixes #9459

Follow up on #9427

Code changes

In #9427, we introduced a new styleModule key instead of guessing about there being a js file corresponding to a style file. That change did not propagate to prebuilt extensions. This commit fixes prebuilt extensions to use styleModule if available.

Still draft while I modify one of the examples to use styleModule and at least manually check that it is working.

User-facing changes

Backwards-incompatible changes

In jupyterlab#9427, we introduced a new styleModule key instead of guessing about there being a js file corresponding to a style file. That change did not propagate to prebuilt extensions. This commit fixes prebuilt extensions to use styleModule if available.

Fixes jupyterlab#9459
@jasongrout jasongrout added this to the 3.0 milestone Dec 11, 2020
@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jasongrout
Copy link
Contributor Author

Good news: this does work (minimally)

Bad news: importing specific modules in a package (e.g., A/style/index.js imports B/style/index.js) does not deduplicate in prebuilt extensions right now. This means that this css deduplication strategy does not work now. More generally, importing a specific module from a shared package will duplicate that module rather than use the shared package version. For example, a prebuilt extension cannot import tokens from mypackage/tokens (since it would duplicate the tokens module, making it useless).

I think we can solve these issues by changing our build system for 3.1—I don't think that any of the changes to make these work requires a breaking change.

Good news 2: likely this is a corner case that is rare among extensions (importing dependency css, or importing from a tokens file or other non-main module in a package, and wanting it to be deduped).

Good news 3: source extensions should be deduped as usual - this only becomes a limitation of prebuilt extensions.

@jasongrout jasongrout marked this pull request as ready for review December 14, 2020 18:46
@jasongrout
Copy link
Contributor Author

Merging since this (a) fixes a bug and (b) makes things consistent, even if it isn't helpful in practice yet.

@jasongrout jasongrout merged commit 76388fe into jupyterlab:master Dec 14, 2020
@jasongrout
Copy link
Contributor Author

Bad news: importing specific modules in a package (e.g., A/style/index.js imports B/style/index.js) does not deduplicate in prebuilt extensions right now. This means that this css deduplication strategy does not work now. More generally, importing a specific module from a shared package will duplicate that module rather than use the shared package version. For example, a prebuilt extension cannot import tokens from mypackage/tokens (since it would duplicate the tokens module, making it useless).

I experimented with a fix in #9475

@github-actions github-actions bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Jun 14, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prebuilt extensions should use styleModule
2 participants