Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Fix: Astro generates empty .-index.bundle.js

withastro#5400

* Create loud-penguins-tickle.md
  • Loading branch information
impcyber committed Nov 15, 2022
1 parent a93aa4e commit 3c5cb69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/loud-penguins-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix: https://github.com/withastro/astro/issues/5400
3 changes: 2 additions & 1 deletion packages/astro/src/core/build/css-asset-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function shortHashedName(id: string, ctx: { getModuleInfo: GetModuleInfo

export function createSlugger(settings: AstroSettings) {
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 sep = '-';
return function (id: string, ctx: { getModuleInfo: GetModuleInfo }): string {
Expand All @@ -33,7 +34,7 @@ export function createSlugger(settings: AstroSettings) {
.map(([page]) => page.id)
.sort()
.join('-');
const firstParentId = parents[0]?.[0].id || 'index';
const firstParentId = parents[0]?.[0].id || indexPage;

// Use the last two segments, for ex /docs/index
let dir = firstParentId;
Expand Down

0 comments on commit 3c5cb69

Please sign in to comment.