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: mark custom layers as externals #225

Merged
merged 3 commits into from
Nov 24, 2022
Merged

Conversation

eduardoboucas
Copy link
Member

Which problem is this pull request solving?

The key for making custom layers (added in #198) work is to make the ESZIP load treat them as external specifiers. This has been done in #201, and allows any specifier, like layer:something, to work.

But using this type of specifier comes with the challenge of always requiring an import map for the code to even run, so we'd need to inject these custom specifiers into the import maps used for local development and for the in-source configuration extraction.

Alternatively, we could use valid URLs for layers (e.g. https://some-url.netlify.app/mod.ts) and still have the ESZIP load mark them as external, so that they're not included in the bundle and get stitched together at runtime. In other contexts, like local development or ISC, the URL will work as normal, with no additional work required.

This PR introduces an externals property, which is a list of specifiers that the ESZIP loader should set as external. When bundling, we'll read the internal configuration file and set every layer name as external.

@eduardoboucas eduardoboucas added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Nov 24, 2022
@eduardoboucas eduardoboucas requested a review from a team November 24, 2022 09:33
@eduardoboucas eduardoboucas merged commit a68607b into main Nov 24, 2022
@eduardoboucas eduardoboucas deleted the feat/layers-external branch November 24, 2022 10:22
Skn0tt pushed a commit to netlify/build that referenced this pull request Apr 23, 2024
* feat!: remove support for JavaScript bundles

* feat: add layers as externals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants