Skip to content

fix(rollup): call fileName hook with assetsDir and debug:true #7638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gold-colts-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/qwik': patch
---

FIX: assetsDir and debug:true will no longer break your application.
16 changes: 13 additions & 3 deletions packages/qwik/src/optimizer/src/plugins/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,22 @@ export function normalizeRollupOutputOptionsObject(
return `build/${sanitized}.js`;
};
}
// client production output
// client development/debug output
const getFilePath = (fileNamePattern: string | ((info: Rollup.PreRenderedChunk) => string)) =>
typeof fileNamePattern === 'string'
? useAssetsDir
? `${opts.assetsDir}/${fileNamePattern}`
: fileNamePattern
: useAssetsDir
? (chunkInfo: Rollup.PreRenderedChunk) =>
`${opts.assetsDir}/${fileNamePattern(chunkInfo)}`
: (chunkInfo: Rollup.PreRenderedChunk) => fileNamePattern(chunkInfo);

if (!outputOpts.entryFileNames) {
outputOpts.entryFileNames = useAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
outputOpts.entryFileNames = getFilePath(fileName);
}
if (!outputOpts.chunkFileNames) {
outputOpts.chunkFileNames = useAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName;
outputOpts.chunkFileNames = getFilePath(fileName);
}
} else if (opts.buildMode === 'production') {
// server production output
Expand Down
Loading