Skip to content

Commit

Permalink
fix glob to exclude +server.js and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gtm-nayan committed May 21, 2024
1 parent ed2ef30 commit c778f78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
5 changes: 4 additions & 1 deletion packages/kit/src/exports/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ async function kit({ svelte_config }) {
cors: { preflightContinue: true }
},
optimizeDeps: {
entries: [`${kit.files.routes}/**/+*.{svelte,js,ts}`, `!${kit.files.routes}/**/+*.server.{svelte,js,ts}`],
entries: [
`${kit.files.routes}/**/+*.{svelte,js,ts}`,
`!${kit.files.routes}/**/+*server.{svelte,js,ts}`
],
exclude: [
'@sveltejs/kit',
// exclude kit features so that libraries using them work even when they are prebundled
Expand Down
20 changes: 0 additions & 20 deletions packages/kit/test/apps/dev-only/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,6 @@ test.describe('Vite', () => {
expect(manifest).toHaveProperty('optimized.e2e-test-dep-page-universal');
});

test('optimizes +page.server.js dependencies', async ({ page }) => {
await page.goto('/');
await page.getByText('hello world!').waitFor();

const manifest_path = path.join(__dirname, '../node_modules/.vite/deps/_metadata.json');
const manifest = JSON.parse(fs.readFileSync(manifest_path, 'utf-8'));

expect(manifest).toHaveProperty('optimized.e2e-test-dep-page-server');
});

test('optimizes +layout.svelte dependencies', async ({ page }) => {
await page.goto('/');
await page.getByText('hello world!').waitFor();
Expand All @@ -137,16 +127,6 @@ test.describe('Vite', () => {
expect(manifest).toHaveProperty('optimized.e2e-test-dep-layout-universal');
});

test('optimizes +layout.server.js dependencies', async ({ page }) => {
await page.goto('/');
await page.getByText('hello world!').waitFor();

const manifest_path = path.join(__dirname, '../node_modules/.vite/deps/_metadata.json');
const manifest = JSON.parse(fs.readFileSync(manifest_path, 'utf-8'));

expect(manifest).toHaveProperty('optimized.e2e-test-dep-layout-server');
});

test('optimizes +error.svelte dependencies', async ({ page }) => {
await page.goto('/');
await page.getByText('hello world!').waitFor();
Expand Down

0 comments on commit c778f78

Please sign in to comment.