mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
Only add framework component formats to Vite’s optimizeDeps
(#11472)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
This commit is contained in:
parent
a3f819f29b
commit
f6a7824597
2 changed files with 7 additions and 7 deletions
5
.changeset/chatty-spies-jog.md
Normal file
5
.changeset/chatty-spies-jog.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Avoids targeting all files in the `src/` directory for eager optimization by Vite. After this change, only JSX, Vue, Svelte, and Astro components get scanned for early optimization.
|
|
@ -120,13 +120,8 @@ export async function createVite(
|
|||
customLogger: createViteLogger(logger, settings.config.vite.logLevel),
|
||||
appType: 'custom',
|
||||
optimizeDeps: {
|
||||
// Scan all files within `srcDir` except for known server-code (e.g endpoints)
|
||||
entries: [
|
||||
`${srcDirPattern}!(pages)/**/*`, // All files except for pages
|
||||
`${srcDirPattern}pages/**/!(*.js|*.mjs|*.ts|*.mts)`, // All pages except for endpoints
|
||||
`${srcDirPattern}pages/**/_*.{js,mjs,ts,mts}`, // Remaining JS/TS files prefixed with `_` (not endpoints)
|
||||
`${srcDirPattern}pages/**/_*/**/*.{js,mjs,ts,mts}`, // Remaining JS/TS files within directories prefixed with `_` (not endpoints)
|
||||
],
|
||||
// Scan for component code within `srcDir`
|
||||
entries: [`${srcDirPattern}**/*.{jsx,tsx,vue,svelte,html,astro}`],
|
||||
exclude: ['astro', 'node-fetch'],
|
||||
},
|
||||
plugins: [
|
||||
|
|
Loading…
Reference in a new issue