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

Add style package export for dist/style.css #125

Merged
merged 2 commits into from
Nov 7, 2023

Conversation

kerryarchibald
Copy link
Contributor

The following syntax will set the style condition:

@kerryarchibald kerryarchibald added the enhancement New feature or request label Nov 2, 2023
@kerryarchibald kerryarchibald requested a review from a team as a code owner November 2, 2023 23:14
@kerryarchibald kerryarchibald requested review from andybalaam and dbkr and removed request for a team November 2, 2023 23:14
Copy link

cloudflare-workers-and-pages bot commented Nov 2, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 263e7d4
Status: ✅  Deploy successful!
Preview URL: https://70993fac.compound-web.pages.dev
Branch Preview URL: https://kerry-styles-export.compound-web.pages.dev

View logs

Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

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

In wasn't aware of this but looks like it's a thing that webpack reads (https://webpack.js.org/guides/package-exports/#conditions)? Looks fine. What happened if the style export wasn't set? It failed rather than falling back to one of the others?

@kerryarchibald
Copy link
Contributor Author

In wasn't aware of this but looks like it's a thing that webpack reads (https://webpack.js.org/guides/package-exports/#conditions)? Looks fine. What happened if the style export wasn't set? It failed rather than falling back to one of the others?

Yep, when the specific type is not specified it will result in module not found:

When the exports field is specified, only these module requests are available. Any other requests will lead to a ModuleNotFound Error.

package.json Outdated
@@ -13,7 +13,8 @@
},
"./dist/style.css": {
"require": "./dist/style.css",
"import": "./dist/style.css"
"import": "./dist/style.css",
"style": "./dist/style.css"
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it make sense then to set it in the . import? I think that would make @import "@vector-im/compound-web" work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh good idea!

@kerryarchibald kerryarchibald merged commit d67293a into main Nov 7, 2023
6 of 7 checks passed
@kerryarchibald kerryarchibald deleted the kerry/styles-export branch November 7, 2023 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants