-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Netlify CMS always includes Netlify Identity Widget in JS #9209
Comments
cc @erquhart - can we use |
This is mostly about how Netlify CMS itself is distributed - it currently includes all first party extensions, one of which is the Netlify Git Gateway backend. There's plenty of unecessary code there for sure, it's something we're definitely planning to improve. That said, the Netlify CMS plugin creates and outputs it's own build straight to the @pieh I haven't used |
I guess it comes from here https://github.com/gatsbyjs/gatsby/blob/6e0a7ae4f5b0f965368d0a8b5e1ccf95240045f9/packages/gatsby-plugin-netlify-cms/src/gatsby-browser.js - importing it in gatsby-browser will include that in app bundle even if
I would go with Would You like to try creating PR for this @nakedible? |
Ah, forget everything I said, it's that import, right. Can Gatsby's webpack/babel setup handle dynamic imports? That'd be a pretty ideal approach here. |
Yeah, you can do dynamic imports |
Actually, I do not understand why I can make a PR, but I need to understand first the rationale behind the current choices. To clarify: I don't understand why |
Many Netlify CMS users also use the identity widget. When you first sign up with the identity widget, you have to confirm your email, and the link in your email must send you to your site root. The widget must be running to catch you there with the auth token and forward you to your CMS page. If Gatsby had a way to target specific pages with |
Okay, that means that for the user who does not use Netlify Identity on their website, but does wish to use Netlify Identity for Netlify CMS only, the only approach currently is to include extra 161 kB in every page load (or atleast for site root loads, which is about as bad). So this is because the confirm emails are not directing the user to /admin/, but instead to the site root, the site root must handle netlify identity email confirmations. That is unfortunate. I did some digging in the netlify-identity-widget internals, and noticed that these are things it processes:
These are matched from the hash portion of the URI. So, at least a few choices:
But, not sure if I have to motivation to fix those (at least yet), because currently I don't use Netlify Identity at all, not even for Netlify CMS. I'll see about fixing the problem for my use case. |
Dynamically loading when the hash is present could work. |
According to Google Pagespeed Insights, this 49kb JS file is loading in a blocking fashion, and causing 1s of rendering delay. Not having this will be desirable. |
Description
Netlify identity widget can be disabled for
gatsby-plugin-netlify-cms
by specifyingenableIdentityWidget: false
in configuration. I would expect that this would also ensure that the netlify identity widget would not be included in the built application JS files through WebPack. However, by usingsource-map-explorer
that there is 161 kB ofnetlify-identity-widget
present in the build.Steps to reproduce
npm run build
npx source-map-explorer public/app-*.js
Expected result
Netlify-identity-widget should be excluded if disabled.
Actual result
Netlify-identity-widget is included in JS bundle.
Environment
Cannot get info due to #8502
The text was updated successfully, but these errors were encountered: