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

initial webpack externals support #7245

Merged
merged 3 commits into from
Aug 13, 2018
Merged

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Aug 11, 2018

This disables bundling some of the packages when creating bundle for rendering static HTML, which decrease time needed to build that bundle.

Here's some statistics - https://docs.google.com/spreadsheets/d/1kT7tyEmVtuev3fkyQPMMoymF1W5iEl6dv7TfA_TQz2M/edit?usp=sharing

Closes #5605

@KyleAMathews
Copy link
Contributor

KyleAMathews commented Aug 11, 2018

Deploy preview for using-postcss-sass failed.

Built with commit b936f3a

https://app.netlify.com/sites/using-postcss-sass/deploys/5b717cc33813f026e858f60d

@KyleAMathews
Copy link
Contributor

Deploy preview for using-jss failed.

Built with commit 45d3f6a

https://app.netlify.com/sites/using-jss/deploys/5b6ebf8f3813f05fa058f642

@gatsbybot
Copy link
Collaborator

gatsbybot commented Aug 11, 2018

Deploy preview for using-drupal ready!

Built with commit b936f3a

https://deploy-preview-7245--using-drupal.netlify.com

@KyleAMathews
Copy link
Contributor

KyleAMathews commented Aug 11, 2018

Deploy preview for gatsbyjs failed.

Built with commit b936f3a

https://app.netlify.com/sites/gatsbyjs/deploys/5b717cc23813f026e858f601

@gatsbybot
Copy link
Collaborator

gatsbybot commented Aug 11, 2018

Deploy preview for gatsbygram ready!

Built with commit b936f3a

https://deploy-preview-7245--gatsbygram.netlify.com

KyleAMathews
KyleAMathews previously approved these changes Aug 11, 2018
Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

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

Looks great! Exciting!

.renderHTML({
htmlComponentRendererPath,
paths: pageSegment,
envVars: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment mentioning these are just variables that we set internally and we don't need to set others as the child process will pick them up from the environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

const externalList = [
/^lodash/,
`react`,
/^react-dom/,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this have lodash and react-dom as strings along with the regexes?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh wait. ignore me 🤦‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lodash is regexp because otherwise it wouldn't catch things like require(lodash/merge`)

react-dom could be changed to string if I would use "react-dom" and "react-dom/server"

Copy link

@alpgumus alpgumus Aug 14, 2018

Choose a reason for hiding this comment

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

When I use this with redux, 'develop/build html' fails because of lodash-es package

@pieh pieh merged commit 05b8580 into gatsbyjs:master Aug 13, 2018
@pieh pieh deleted the node-externals-initial branch August 13, 2018 16:56
m-allanson added a commit to phacks/gatsby that referenced this pull request Aug 14, 2018
* master: (597 commits)
  Add a site(https://mojaave.com) to showcase list (gatsbyjs#7275)
  feat: create a doc for open source pair programming sessions (gatsbyjs#7266)
  [docs] Add video lesson to the StaticQuery docs (gatsbyjs#7249)
  [v2] docs - update page query docs (gatsbyjs#7285)
  [v2] docs "Styling" overview (gatsbyjs#7288)
  Remove delay (gatsbyjs#7273)
  add site (gatsbyjs#7291)
  Adding new site to the showcase. (gatsbyjs#7281)
  chore(release): Publish
  initial webpack externals support (gatsbyjs#7245)
  add missing package dependencies (gatsbyjs#7259)
  add: custom configuration overview
  (gatsbyjs#7231): tutorial part four updates (gatsbyjs#7240)
  [www] Fix showcase search, checkbox styles (gatsbyjs#7014)
  (gatsbyjs#6584): Restructure plugin overview and plugin authoring pages (gatsbyjs#7229)
  Use Hubspot form for email subscription (gatsbyjs#7233)
  Adding bootstrap CV starter (gatsbyjs#7207)
  Stub Articles and new names (gatsbyjs#7200)
  Improve readability of verbose logging code in wordpress source plugin (gatsbyjs#7146)
  Update hash link to scroll to right section of page (gatsbyjs#7161)
  ...
porfirioribeiro pushed a commit to porfirioribeiro/gatsby that referenced this pull request Aug 22, 2018
* initial webpack externals support

* dont recreate env vars object for every segment

* add comment that we only need to set process.env variables that are set programatically in gatsby-cli
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.

5 participants