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

Upgrade Vite to 3.2 #5212

Merged
merged 5 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


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

Upgrade Vite to 3.2
5 changes: 5 additions & 0 deletions .changeset/wicked-pans-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Allow importing public files in SSR
4 changes: 2 additions & 2 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"recast": "^0.20.5",
"rehype": "^12.0.1",
"resolve": "^1.22.0",
"rollup": "~2.78.0",
"rollup": "^2.79.1",
"semver": "^7.3.7",
"shiki": "^0.11.1",
"sirv": "^2.0.2",
Expand All @@ -157,7 +157,7 @@
"typescript": "*",
"unist-util-visit": "^4.1.0",
"vfile": "^5.3.2",
"vite": "~3.1.3",
"vite": "~3.2.0",
"vitefu": "^0.1.0",
"yargs-parser": "^21.0.1",
"zod": "^3.17.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/build/static-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
emptyOutDir: false,
manifest: false,
outDir: fileURLToPath(out),
copyPublicDir: false,
rollupOptions: {
...viteConfig.build?.rollupOptions,
input: [],
Expand All @@ -138,7 +139,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
ssr: true,
// improve build performance
minify: false,
polyfillModulePreload: false,
Copy link
Member Author

Choose a reason for hiding this comment

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

This is now deprecated in favour of the modulePreload field.

modulePreload: { polyfill: false },
reportCompressedSize: false,
},
plugins: [
Expand All @@ -154,7 +155,6 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
settings.config.output === 'server' && vitePluginSSR(internals, settings.adapter!),
vitePluginAnalyzer(internals),
],
publicDir: ssr ? false : viteConfig.publicDir,
envPrefix: 'PUBLIC_',
base: settings.config.base,
};
Expand Down
13 changes: 13 additions & 0 deletions packages/astro/test/fixtures/vue-component/public/favicon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<img id="vue-img" src="/favicon.svg" alt="logo" />
</template>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import Counter from '../components/Counter.vue'
import Img from '../components/Img.vue'
---
<html lang="en">
<head>
Expand Down Expand Up @@ -28,6 +29,7 @@ import Counter from '../components/Counter.vue'
<!-- Test that two client:visibles have unique uids -->
<Counter start="100" client:visible>SSR Rendered, client:visible</Counter>
<Counter start="1000" client:visible>SSR Rendered, client:visible</Counter>
<Img />
</main>
</body>
</html>
3 changes: 3 additions & 0 deletions packages/astro/test/vue-component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ describe('Vue component', () => {
// test 5: components with identical render output and props have been deduplicated
const uniqueRootUIDs = $('astro-island').map((i, el) => $(el).attr('uid'));
expect(new Set(uniqueRootUIDs).size).to.equal(5);

// test 6: import public files work
expect($('#vue-img')).to.be.ok;
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/webapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"formdata-polyfill": "^4.0.10",
"magic-string": "^0.25.9",
"mocha": "^9.2.2",
"rollup": "^2.75.6",
"rollup": "^2.79.1",
"rollup-plugin-terser": "^7.0.2",
"tslib": "^2.4.0",
"typescript": "~4.7.3",
Expand Down
39 changes: 17 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.