-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[styles] Upgrade JSS to v10-alpha #14006
Conversation
5f5fc3a
to
12af3de
Compare
import jssPropsSort from 'jss-props-sort'; | ||
import functions from 'jss-plugin-rule-value-function'; | ||
import global from 'jss-plugin-global/dist/jss-plugin-global.cjs'; | ||
import nested from 'jss-plugin-nested/dist/jss-plugin-nested.cjs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is something broken with esm version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have faced this exact issue: pmndrs/react-spring#278. Seems to affect Next.js and Gatsby.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which exactly? I see people described a few different issues there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an issue with the export syntax.
(function (exports, require, module, __filename, __dirname) { import _extends from '@babel/runtime/helpers/esm/extends';
^^^^^^^^
SyntaxError: Unexpected identifier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like next.js resolves all imports using bundler which of course makes the output full of imports. The interesting thing is why only these two packages are broken? jss itself has the same setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the linked issue, it might also be an issue with Gatbsy but I haven't spent the time to test that hypothesis. JSS v10, while in alpha, looks good to me from an "output" perspective. It's larger but faster. My main concern is with the upgrade path. We need to make sure it's working with no breaking change. I'm gonna try to scope the update to @material-ui/styles
.
6d4d3ac
to
d71b4d1
Compare
I'm splitting this pull-requests into different chunks; so we focus on JSS v10 here. |
06622dd
to
d6a99ca
Compare
d6a99ca
to
36f2b60
Compare
@eps1lon Any idea how we could solve the TypeScript CI fail? |
Well some are mostly typo changes ( If we don't want to propagate those to our users we have map them e.g. when handling |
The visual regression test fail confirms that JSS v10 add support for nested style function 🎉. well done @kof. @eps1lon Thank you for the fix! I have tried to isolate the changes to |
I'm gonna try to better leverage the resolution feature of yarn to remove the TypeScript broken change. |
The only breaking change is basically that wherever we have -{ generateClassName }
+{ generateId: generateClassName } That applies to Everything else is just internal. |
I have never seen anyone use the generateClassName option of the withStyles, it might not even work. |
@@ -182,7 +183,8 @@ | |||
"workbox-build": "^3.6.3" | |||
}, | |||
"resolutions": { | |||
"**/hoist-non-react-statics": "^3.2.1" | |||
"**/hoist-non-react-statics": "^3.2.1", | |||
"jss": "^10.0.0-alpha.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliviertassinari What was the reason for this? This means we only test with an alpha version of jss not the latest stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this resolution, yarn will install JSS v10 and v9 at the same time. It breaks at runtime. I wish we had a better alternative.
Gain around 10% of speed on the whole spectrum.