Skip to content

Commit

Permalink
Upgrade Vite to 3.2 (#5212)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Oct 28, 2022
1 parent 0b12414 commit a609a89
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 28 deletions.
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 @@ -146,7 +146,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 @@ -158,7 +158,7 @@
"typescript": "*",
"unist-util-visit": "^4.1.0",
"vfile": "^5.3.2",
"vite": "~3.1.3",
"vite": "~3.2.1",
"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: !ssr,
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,
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
Loading
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
41 changes: 18 additions & 23 deletions pnpm-lock.yaml

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

0 comments on commit a609a89

Please sign in to comment.