Skip to content

Commit

Permalink
output filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
rossrobino committed Sep 29, 2024
1 parent 437ff91 commit f106fac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .changeset/little-islands-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"domco": patch
---

Use `name` in the output filename instead of as a directory for easier debugging in production dev tools. Now the name will show up in the network tab instead of just the hash.

Example:

`dist/client/_immutable/name/hash.js` is now `dist/client/_immutable/name.hash.js`
2 changes: 1 addition & 1 deletion apps/tester/src/client/+page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="/circle.svg" />
<script type="module" src="/client/+script.ts"></script>
<script type="module" src="/client/client.ts"></script>
<link rel="stylesheet" href="/client/style.css" />
<title>domco tester</title>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { version } from "domco/version";
console.log(version);

const p = document.createElement("p");
p.textContent = "client js script";
p.textContent = "client js";
document.body.append(p);
6 changes: 3 additions & 3 deletions packages/domco/src/plugin/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export const configPlugin = async (
output: {
entryFileNames({ name }) {
if (name.startsWith("/")) name = name.slice(1);
return `${isSsrBuild ? "" : dirNames.out.client.immutable + "/"}${name}${isSsrBuild ? "" : "/[hash]"}.js`;
return `${isSsrBuild ? "" : dirNames.out.client.immutable + "/"}${name}${isSsrBuild ? "" : ".[hash]"}.js`;
},
assetFileNames: `${isSsrBuild ? "" : dirNames.out.client.immutable + "/"}assets/[name]/[hash][extname]`,
chunkFileNames: `${isSsrBuild ? "" : dirNames.out.client.immutable + "/"}chunks/[name]/[hash].js`,
assetFileNames: `${isSsrBuild ? "" : dirNames.out.client.immutable + "/"}assets/[name].[hash][extname]`,
chunkFileNames: `${isSsrBuild ? "" : dirNames.out.client.immutable + "/"}chunks/[name].[hash].js`,
},
},
// `rel=modulepreload` is supported in all major browsers as of 2023
Expand Down

0 comments on commit f106fac

Please sign in to comment.