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

fix(container): apply polyfill #12042

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fast-queens-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a problem in the Container API, where a polyfill wasn't correctly applied. This caused an issue in some environments where `crypto` isn't supported.
1 change: 1 addition & 0 deletions packages/astro/src/container/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './polyfill.js';
import { posix } from 'node:path';
import type {
AstroConfig,
Expand Down
3 changes: 3 additions & 0 deletions packages/astro/src/container/polyfill.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { applyPolyfills } from '../core/app/node.js';
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason for the separate file?

Copy link
Member

Choose a reason for hiding this comment

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

that's because it needs to run first, even before other imports. We did that on the adapters repo as well

Copy link
Member

@Princesseuh Princesseuh Sep 20, 2024

Choose a reason for hiding this comment

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

ah yea, bundling. Annoying. The original file should probably be made a side effect though. We could have like a import "astro/polyfill"; thing. But I guess this is our last polyfills so, we don't care very much

Copy link
Member

Choose a reason for hiding this comment

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

yeah that's also what i thought, probably not worth it at this point


applyPolyfills();
Loading