Skip to content

Commit

Permalink
remove Vite static asset middleware (sveltejs#4535)
Browse files Browse the repository at this point in the history
* remove Vite static asset middleware

* Update packages/kit/test/apps/basics/test/test.js

Co-authored-by: Mihael Mutić <35368241+PH4NTOMiki@users.noreply.github.com>

* alternative approach

* update descriptions

Co-authored-by: Mihael Mutić <35368241+PH4NTOMiki@users.noreply.github.com>
  • Loading branch information
Rich-Harris and PH4NTOMiki authored Apr 6, 2022
1 parent 1330b85 commit 32a7ccf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/shaggy-geckos-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Remove `static` directory from Vite's control
1 change: 0 additions & 1 deletion packages/kit/src/core/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export async function dev({ cwd, port, host, https, config }) {
fs: {
allow: [
...new Set([
config.kit.files.assets,
config.kit.files.lib,
config.kit.files.routes,
config.kit.outDir,
Expand Down
5 changes: 5 additions & 0 deletions packages/kit/test/apps/basics/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2232,6 +2232,11 @@ test.describe.parallel('Static files', () => {
response = await request.get('/favicon.ico');
expect(response.status()).toBe(200);
});

test('does not use Vite to serve contents of static directory', async ({ request }) => {
const response = await request.get('/static/static.json');
expect(response.status()).toBe(process.env.DEV ? 403 : 404);
});
});

test.describe.parallel('Matchers', () => {
Expand Down

0 comments on commit 32a7ccf

Please sign in to comment.