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

share specific instances of some ui packages #54079

Merged
merged 8 commits into from
Jan 10, 2020

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Jan 6, 2020

Usually to maintain some level of module state, some packages require that a single instance is used per page, like React and moment/moment-timezone. To support this for the up-coming new platform plugin build system, we need a static library containing all of these modules that can be linked to by other packages (using webpack externals or a similar feature in other compilers).

To enable this the @kbn/ui-shared-deps package depends on a number of packages (see packages/kbn-ui-shared-deps/package.json) and builds them into a bundle which, when loaded, creates a __kbnSharedDeps__ global with the module.exports of each bundled dep exposed.

Additionally, a node.js module is included in the package which lists the webpack externals configuration necessary to utilize these packages and a few helper values for finding the built source.

As a side benefit, this will reduce the size of our vendors dll, but I don't think it will be enough to avoid the problems we've been having with caching that file.

image

@spalger spalger force-pushed the implement/shared-deps-package branch 18 times, most recently from aa71ae7 to 093d659 Compare January 9, 2020 06:51
@spalger spalger force-pushed the implement/shared-deps-package branch from 093d659 to 06ccd70 Compare January 9, 2020 07:15
@spalger spalger marked this pull request as ready for review January 9, 2020 19:18
@spalger spalger requested review from a team as code owners January 9, 2020 19:18
@spalger spalger added release_note:skip Skip the PR/issue when compiling release notes Team:Operations Team label for Operations Team v7.6.0 v8.0.0 labels Jan 9, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@@ -417,17 +423,6 @@ export default class BaseOptimizer {
],
};

// We need to add react-addons (and a few other bits) for enzyme to work.
// https://github.com/airbnb/enzyme/blob/master/docs/guides/webpack.md
Copy link
Contributor Author

@spalger spalger Jan 9, 2020

Choose a reason for hiding this comment

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

As stated at this url, this was no longer necessary after upgrading to enzyme 3

Copy link
Contributor

@tylersmalley tylersmalley left a comment

Choose a reason for hiding this comment

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

Outside of the angular being called out for import/no-extraneous-dependencies, this LGTM.

Code looks strait forward and spent some time playing around with it. Your assumption around caching was correct. The vendor DLL is down to 18.7 MB, which is still not being included in the cache for FF in an incognito window.

@tylersmalley
Copy link
Contributor

Mind also adding ops as a codeowner for the new package? I want to make sure we're aware when folks add a new global package as we begin trimming down the vendors file.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@cqliu1 cqliu1 left a comment

Choose a reason for hiding this comment

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

Canvas changes LGTM 👍

@spalger spalger merged commit 357be59 into elastic:master Jan 10, 2020
spalger pushed a commit that referenced this pull request Jan 11, 2020
* share specific instances of some ui packages

* remove unnecessary eslint changes, every package will define deps anyway

* remove mentions of moment webpackShims in eslint resolver

* remove use of lodash

* list angular as dep for x-pack

* add operations as codeowner of shared-deps pkg

# Conflicts:
#	.github/CODEOWNERS
#	src/optimize/base_optimizer.js
#	yarn.lock
@spalger
Copy link
Contributor Author

spalger commented Jan 11, 2020

7.x/7.6: 02eead7

@spalger spalger deleted the implement/shared-deps-package branch January 11, 2020 03:20
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 13, 2020
* master: (69 commits)
  [Graph] Fix various a11y issues (elastic#54097)
  Add ApplicationService app status management (elastic#50223)
  logs in one time (elastic#54447)
  Deprecate using `elasticsearch.ssl.certificate` without `elasticsearch.ssl.key` and vice versa (elastic#54392)
  [Optimizer] Fix a stack overflow with watch_cache when it attempts to delete very large folders. (elastic#54457)
  Security - Role Mappings UI (elastic#53620)
  [SIEM] [Detection engine] Permission II (elastic#54292)
  Allow User to Cleanup Repository from UI  (elastic#53047)
  [Detection engine] Some UX for rule creation (elastic#54471)
  share specific instances of some ui packages (elastic#54079)
  [ML] APM modules configs for RUM Javascript and NodeJS (elastic#53792)
  [APM] Delay rendering invalid license notification (elastic#53924)
  [Graph] Improve error message on graph requests (elastic#54230)
  [ILM] Kibana should allow a min_age setting of 0ms in ILM policy phases (elastic#53719)
  Unit Tests for common/lib (elastic#53736)
  [Graph] Only show explorable fields (elastic#54101)
  remove linting rule exception for markdown (elastic#54232)
  [Monitoring] Fetch shard data more efficiently (elastic#54028)
  [Maps] Add hiddenLayers option to embeddable map input (elastic#54355)
  Pass termOrder and hasTermsAgg properties to serializeThresholdWatch function (elastic#54391)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 13, 2020
* master: (69 commits)
  [Graph] Fix various a11y issues (elastic#54097)
  Add ApplicationService app status management (elastic#50223)
  logs in one time (elastic#54447)
  Deprecate using `elasticsearch.ssl.certificate` without `elasticsearch.ssl.key` and vice versa (elastic#54392)
  [Optimizer] Fix a stack overflow with watch_cache when it attempts to delete very large folders. (elastic#54457)
  Security - Role Mappings UI (elastic#53620)
  [SIEM] [Detection engine] Permission II (elastic#54292)
  Allow User to Cleanup Repository from UI  (elastic#53047)
  [Detection engine] Some UX for rule creation (elastic#54471)
  share specific instances of some ui packages (elastic#54079)
  [ML] APM modules configs for RUM Javascript and NodeJS (elastic#53792)
  [APM] Delay rendering invalid license notification (elastic#53924)
  [Graph] Improve error message on graph requests (elastic#54230)
  [ILM] Kibana should allow a min_age setting of 0ms in ILM policy phases (elastic#53719)
  Unit Tests for common/lib (elastic#53736)
  [Graph] Only show explorable fields (elastic#54101)
  remove linting rule exception for markdown (elastic#54232)
  [Monitoring] Fetch shard data more efficiently (elastic#54028)
  [Maps] Add hiddenLayers option to embeddable map input (elastic#54355)
  Pass termOrder and hasTermsAgg properties to serializeThresholdWatch function (elastic#54391)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Operations Team label for Operations Team v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants