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

[FEAT] Override externals #40

Merged
merged 1 commit into from
Nov 30, 2020
Merged

[FEAT] Override externals #40

merged 1 commit into from
Nov 30, 2020

Conversation

schlusslicht
Copy link
Contributor

@schlusslicht schlusslicht commented Nov 28, 2020

What this pull request does
This pull request enables the consumer to configure the list of external rollup module IDs. Any value set to the external configuration property overrides the inherited rollup external option with the value provided.

What this pull request contains

  • implementation
  • documentation

Further notes
My use case is creating a library with an inlined webworker to be used by downstream projects on different platforms. To achieve this, the bundled webworker needs to contain all transpiled imports, as downstream bundlers will not be able to package additional dependencies into the blob. By setting the newly introduced property external: [], I can instruct rollup to consider no imports as external and bundle them into the worker blob. Which I can then savely distribute as functional part of my library.

Let me know what You think! 🎈

@darionco
Copy link
Owner

My first reaction when I saw this was that it could cause conflicts with the consuming code, on a second thought though, that shouldn't be a problem since workers run on isolated contexts. Maybe if the main thread and workers pass objects around from incompatible versions of a library, but that is a corner case and I think it would be reasonable to require consumers to make sure library versions are compatible.

I couldn't think of a better solution to this specific problem without requiring consumers to use rollup and this plugin (or equivalent tooling) which would be inconvenient. It is worth noting that using this functionality will increase payload size, yet again, can't think of a better solution.

I'll merge this and release a new version. Thank you for your contribution!

@darionco darionco merged commit 643406c into darionco:master Nov 30, 2020
@darionco
Copy link
Owner

Released in version 1.5.0

@schlusslicht schlusslicht deleted the feat/config-external branch November 30, 2020 16:36
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

2 participants