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

fix(gatsby-plugin-netlify-cms): dynamically import netlify-identity-widget #9565

Merged
merged 3 commits into from Nov 29, 2018
Merged

fix(gatsby-plugin-netlify-cms): dynamically import netlify-identity-widget #9565

merged 3 commits into from Nov 29, 2018

Conversation

alexandernanberg
Copy link
Contributor

@alexandernanberg alexandernanberg commented Oct 30, 2018

Closes #9209

Also had to add plugin-syntax-dynamic-import to the babel-preset-gatsby-package config

@alexandernanberg
Copy link
Contributor Author

Not sure about the circleci errors, seems like the registry went down?

@DSchau
Copy link
Contributor

DSchau commented Oct 30, 2018

@alexandernanberg seems to be the case 😩 May need to re-run these in a few minutes, but don't worry about them failing for now!

@alexandernanberg alexandernanberg changed the title fix(gatsby-plugin-netlify-cms): dynamically import fix(gatsby-plugin-netlify-cms): dynamically import netlify-identity-widget Oct 30, 2018
Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

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

Looks good; left a comment!

const errorRoute = /error=access_denied&error_description=403/
const accessTokenRoute = /access_token=/

exports.onInitialClientRender = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this whole block anything we want to test for? I'd think adding some tests would be really valuable here, even if "just" unit tests!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that would be nice. Not sure how tho, since it's a dynamic import things become a bit more tricky. Are there any similar tests a can look at to get going?

@alexandernanberg
Copy link
Contributor Author

@DSchau I've given this some more thought and AFAK there is no good way to unit test this – without changing the source 🤔 Do you have any ideas?

@DSchau
Copy link
Contributor

DSchau commented Nov 2, 2018

@alexandernanberg it's probably OK, don't worry about it!

One thing I missed the first time... shouldn't @babel/plugin-syntax-dynamic-import be added as a dependency of babel-preset-gatsby-package?

@alexandernanberg
Copy link
Contributor Author

@DSchau Good catch, I've added it now!

@alexandernanberg alexandernanberg requested a review from a team as a code owner November 7, 2018 19:28
@alexandernanberg alexandernanberg requested a review from a team November 7, 2018 19:28
@alexandernanberg alexandernanberg requested a review from a team as a code owner November 7, 2018 19:28
@shannonbux
Copy link
Contributor

Anyone know why @gatsbyjs/docs got assigned to review this PR? Though I'm happy to help, I'm not the one you want for reviewing .js files :). .md, on the other hand...I'm all about that

@alexandernanberg
Copy link
Contributor Author

@shannonbux Sorry about that – I had a newer version of prettier installed locally that formatted some files automatically, but I removed them from this PR when I realized that

@alexandernanberg
Copy link
Contributor Author

@DSchau Is there anything else that you want me to fix or is this ready to get merged? Would be nice to shave off ~50kb of the bundlesize for the current site I'm working on 😄

@pieh
Copy link
Contributor

pieh commented Nov 13, 2018

@alexandernanberg I think this should reviewd by @erquhart - I don't have enough context on netlify-identity-widget :/

Copy link
Contributor

@erquhart erquhart left a comment

Choose a reason for hiding this comment

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

netlify/netlify-identity-widget#157 is unlikely to go through any time soon - this is better than nothing for now. Thanks @alexandernanberg!

@erquhart erquhart merged commit 49100e9 into gatsbyjs:master Nov 29, 2018
@alexandernanberg alexandernanberg deleted the feat/dynamically-import-netlify-cms branch November 29, 2018 04:58
@jedrichards
Copy link
Contributor

Wahoo, my bundle size will halve with this. Thanks guys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants