-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
netlify-identity-widget always included in bundle, adding 166k #17568
Comments
@Undistraction did you manage to find a way to get netlify-identity-widget out of your bundles? Is there a way of using null loader to exclude it in the webpack config? |
@lfeddern We didn't want the CMS on production (we have a workflow that involves promoting changes on staging to production) so I just checked |
@erquhart any idea why the CMS is being baked into the bundle? |
Sounds like dynamic importing isn't working. We'll take a look soon. |
Temporary workaround: If not using module: {
rules: [
{
test: /netlify-identity-widget/,
use: 'null-loader',
}
],
}, complete example for Gatsby: // in gatsby-node.js
exports.onCreateWebpackConfig = ({ stage, actions, rules }) => {
const config = {
module: {
rules: [
{
test: /netlify-identity-widget/,
use: 'null-loader',
},
],
},
};
actions.setWebpackConfig(config);
}; |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
Why are you trying to close a verified bug gatsbot? Still a bug. |
cc/ @erezrokah (can't assign you until your first PR gets merged and you're made a member) |
I'm going to hit this once I'm done with #18245 |
This was supposed to be fixed by #9565 |
This still shows up in our frontend bundle with the latest versions of Gatsby and all plugins. |
Hi @zslabs, I checked again with the repo in the issue description (after updating the plugin) and couldn't reproduce. Do you mind sharing a reproduction? |
@erezrokah Appreciate the reply. Here is a WebPageTest result; if you search for
|
@zslabs the widget is included by default, to disable it you should configure:
|
Appreciate the quick reply! I may be misunderstanding the description of this field:
Does this mean if I disable it, when visiting /admin the widget JS will not be included there? I'm basically looking to disable on the rest of the site, as we are only using it at the /admin path. |
I need to update that description as the identity widget no longer blocks GitLab implicit auth when using the CMS. You need it for your site since email verification links redirect to the root site by default.
|
I really appreciate the insight into that @erezrokah ! |
Description
netlify-identity-widget
is always included in the app bundle, despitegataby-plugin-netlify-cms
being configured not to use it. Even then it shouldn't be included in the app bundle as it is only used on the admin page.Repro based on gatsby-starter-netlify-cms: https://github.com/Undistraction/gatsby-netlify-cms-bug-repro
To replicate
git clone https://github.com/Undistraction/gatsby-netlify-cms-bug-repro.git
cd gatsby-netlify-cms-bug-repro
npm install
npm build
npm run report
Result
netlify-identity-widget is included in the app bundle, adding 166k.
Expected
netlify-identity-widget should not be included in any bundle. Even if configured to use identity, it should only be included in the bundle for the
/admin/
page.Discussion
The only import or reference to
netlify-identity-widget
is in the plugin'scms.identity.js
which should be conditionally loaded from itsgatsby-node.js
andnetlify-identity-widget.js
.Looks like the plugin's
gatsby-node.js
does receive the config correctly and doesn't includecms.identity.js
in the entries, howevernetlify-identity-widget
is still included in the bundle.By commenting out the following lines in the plugin's
gatsby-browser.js
, I can preventnetlify-identity-widget
from being added to the bundle.Not that without these lines commented out, I can place a console.log that confirms that
enableIdentityWidget
isfalse
as expected, and that the promise body of theif
is never run. However gatsby still includesnetlify-identity-widget
in the bundle.Looks like something has changed recently in gatsby core which means that dynamic importing is not working correctly.
Relevant Libs
"gatsby": "^2.15.14"
"gatsby-plugin-netlify-cms": "^4.1.14"
"netlify-cms-app": "^2.9.7"
Plugin config
There is an old, possibly related bug: #9209
Environment
The text was updated successfully, but these errors were encountered: