[kbn/optimizer] update public path before imports#67561
Merged
spalger merged 18 commits intoelastic:masterfrom May 29, 2020
Merged
[kbn/optimizer] update public path before imports#67561spalger merged 18 commits intoelastic:masterfrom
spalger merged 18 commits intoelastic:masterfrom
Conversation
Contributor
|
Pinging @elastic/kibana-operations (Team:Operations) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…lic-path-before-imports
…lic-path-before-imports
…lic-path-before-imports
Contributor
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
Contributor
Author
|
@elastic/kibana-design this includes some scss files but just for testing the optimizer. |
spalger
added a commit
to spalger/kibana
that referenced
this pull request
May 29, 2020
Co-authored-by: spalger <spalger@users.noreply.github.com> # Conflicts: # packages/kbn-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap # packages/kbn-optimizer/src/integration_tests/basic_optimization.test.ts
spalger
added a commit
to spalger/kibana
that referenced
this pull request
May 29, 2020
Co-authored-by: spalger <spalger@users.noreply.github.com> # Conflicts: # packages/kbn-optimizer/src/integration_tests/__snapshots__/basic_optimization.test.ts.snap # packages/kbn-optimizer/src/integration_tests/basic_optimization.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #64226 we moved from replacing the public path in the JS source to an approach that supports setting the
__webpack_public_path__in the webpack bundles with some global variable magic. This relies on a webpack loader which injects some code into the top of each bundle entry point. This works in the kbn-ui-shared-deps where it's easier to test and all modules are imported using commonjs but didn't work for static imports in KP plugins because the public path loader was injecting code into the top of the file and webpack moved the imports up above that code, causing__webpack_public_path__to be updated after the import statements are processed.To fix this we no longer inject code to set
__webpack_public_path__, we inject a dynamic module at the top of the entry bundle which does that, since it's an import the code stays above the rest of the imports in that file. Doing this dynamically required the use of theval-loaderto dynamically generate the source for the module at compilation time.