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 polyfills not being available to imports on Netlify #6117

Merged
merged 10 commits into from
Feb 6, 2023
5 changes: 5 additions & 0 deletions .changeset/silent-dragons-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/netlify': patch
natemoo-re marked this conversation as resolved.
Show resolved Hide resolved
---

Fix polyfills not being available in certain cases
6 changes: 6 additions & 0 deletions packages/astro/src/core/create-vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export async function createVite(
isBuild: mode === 'build',
viteUserConfig: settings.config.vite,
isFrameworkPkgByJson(pkgJson) {
// Certain packages will trigger the checks below, but need to be external. A common example are SSR adapters
// for node-based platforms, as we need to control the order of the import paths to make sure polyfills are applied in time.
if (pkgJson?.astro?.external === true) {
return false;
}

return (
// Attempt: package relies on `astro`. ✅ Definitely an Astro package
pkgJson.peerDependencies?.astro ||
Expand Down
3 changes: 3 additions & 0 deletions packages/integrations/netlify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@
"cheerio": "^1.0.0-rc.11",
"mocha": "^9.2.2",
"vite": "^4.0.3"
},
"astro": {
"external": true
natemoo-re marked this conversation as resolved.
Show resolved Hide resolved
}
}