Skip to content

Commit

Permalink
feat(astro): Add a way for packages to explicitely mark themselves as…
Browse files Browse the repository at this point in the history
… needing to be external
  • Loading branch information
Princesseuh committed Feb 6, 2023
1 parent 2919759 commit b94e619
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 32 deletions.
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
}
}

This file was deleted.

28 changes: 0 additions & 28 deletions packages/integrations/netlify/test/functions/polyfills.test.js

This file was deleted.

0 comments on commit b94e619

Please sign in to comment.