Skip to content

Commit b5fbd8f

Browse files
authored
fix(vite): don't filter out qwik library files (#6760)
1 parent 59c2c43 commit b5fbd8f

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

.changeset/polite-feet-greet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@builder.io/qwik': patch
3+
---
4+
5+
The `fileFilter` option to `qwikVite()` now always allows `*.qwik.{m,c,}js` files so that QRLs in libraries can be processed.

packages/qwik/src/optimizer/src/plugins/plugin.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,13 @@ const RESOLVE_EXTS = {
952952
'.cjs': true,
953953
} as const;
954954

955-
const TRANSFORM_REGEX = /\.qwik\.[mc]?js$/;
955+
/**
956+
* Any file that matches this needs to be processed by Qwik to extract QRL segments etc. Used in
957+
* libraries.
958+
*
959+
* @internal
960+
*/
961+
export const TRANSFORM_REGEX = /\.qwik\.[mc]?js$/;
956962

957963
export const QWIK_CORE_ID = '@builder.io/qwik';
958964

packages/qwik/src/optimizer/src/plugins/vite.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
QWIK_JSX_RUNTIME_ID,
2525
Q_MANIFEST_FILENAME,
2626
SSR_OUT_DIR,
27+
TRANSFORM_REGEX,
2728
createPlugin,
2829
parseId,
2930
type NormalizedQwikPluginOptions,
@@ -68,7 +69,9 @@ export function qwikVite(qwikViteOpts: QwikVitePluginOptions = {}): any {
6869
let rootDir: string | null = null;
6970

7071
let ssrOutDir: string | null = null;
71-
const fileFilter = qwikViteOpts.fileFilter || (() => true);
72+
const fileFilter: QwikVitePluginOptions['fileFilter'] = qwikViteOpts.fileFilter
73+
? (id, type) => TRANSFORM_REGEX.test(id) || qwikViteOpts.fileFilter!(id, type)
74+
: () => true;
7275
const injections: GlobalInjections[] = [];
7376
const qwikPlugin = createPlugin(qwikViteOpts.optimizerOptions);
7477

0 commit comments

Comments
 (0)