Use a user-supplied fetchCJS callback to import CJS plugins #2904
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.
This PR is similar to #2891 but for jbrowse-desktop, which can import CJS modules
Without this PR, a 'http' module polyfill (stream-http) is bundled in jbrowse-web
screenshots with
npx source-map-explorer build/static/js/*.js
in jbrowse-webbefore (see stream-http)
![Screenshot from 2022-04-14 06-39-32](https://user-images.githubusercontent.com/6511937/163392317-4acd3b88-0287-483b-8069-66078d778cce.png)
after (stream-http removed)
![Screenshot from 2022-04-14 06-39-37](https://user-images.githubusercontent.com/6511937/163392335-dafa97b3-14be-4344-bae3-53f872759dac.png)
Also uses
window.require
instead of__non_webpack_require__
which sort of ensures that the electron require machinery is used instead of bundled