* Fix: Astro generates empty .-index.bundle.js https://github.com/withastro/astro/issues/5400 * Create loud-penguins-tickle.md
This commit is contained in:
parent
a93aa4ef3f
commit
3c5cb69488
2 changed files with 7 additions and 1 deletions
5
.changeset/loud-penguins-tickle.md
Normal file
5
.changeset/loud-penguins-tickle.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix: https://github.com/withastro/astro/issues/5400
|
|
@ -25,6 +25,7 @@ export function shortHashedName(id: string, ctx: { getModuleInfo: GetModuleInfo
|
||||||
|
|
||||||
export function createSlugger(settings: AstroSettings) {
|
export function createSlugger(settings: AstroSettings) {
|
||||||
const pagesDir = viteID(new URL('./pages', settings.config.srcDir));
|
const pagesDir = viteID(new URL('./pages', settings.config.srcDir));
|
||||||
|
const indexPage = viteID(new URL("./pages/index", settings.config.srcDir));
|
||||||
const map = new Map<string, Map<string, number>>();
|
const map = new Map<string, Map<string, number>>();
|
||||||
const sep = '-';
|
const sep = '-';
|
||||||
return function (id: string, ctx: { getModuleInfo: GetModuleInfo }): string {
|
return function (id: string, ctx: { getModuleInfo: GetModuleInfo }): string {
|
||||||
|
@ -33,7 +34,7 @@ export function createSlugger(settings: AstroSettings) {
|
||||||
.map(([page]) => page.id)
|
.map(([page]) => page.id)
|
||||||
.sort()
|
.sort()
|
||||||
.join('-');
|
.join('-');
|
||||||
const firstParentId = parents[0]?.[0].id || 'index';
|
const firstParentId = parents[0]?.[0].id || indexPage;
|
||||||
|
|
||||||
// Use the last two segments, for ex /docs/index
|
// Use the last two segments, for ex /docs/index
|
||||||
let dir = firstParentId;
|
let dir = firstParentId;
|
||||||
|
|
Loading…
Add table
Reference in a new issue