Skip to content

Commit 3f4a4bc

Browse files
committed
fix(repl): fix v2 manifest generation due to repl plugins
1 parent 6497a46 commit 3f4a4bc

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

packages/docs/src/repl/bundler/rollup-plugins.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ export const replResolver = (
3535
return srcInputs.find((i) => i.path === id)?.path;
3636
};
3737

38-
const getQwik = (id: string, external?: true) => {
38+
const resolveQwik = (id: string, external?: true) => {
3939
const path = deps[QWIK_PKG_NAME_V1][id];
4040
if (!path) {
4141
throw new Error(`Unknown Qwik path: ${id}`);
4242
}
4343
return {
44-
id: `\0@qwik${id}`,
44+
// Make sure this matches the regexes in manifest.ts
45+
id: `/node_modules/@qwik.dev/core${id}`,
4546
sideEffects: false,
4647
// It would be nice to load qwik as external, but
4748
// we import core and core/build so we need processing
@@ -58,30 +59,30 @@ export const replResolver = (
5859
if (id.startsWith('http')) {
5960
return { id, external: true };
6061
}
61-
if (id.startsWith('\0@qwik/')) {
62+
if (id.startsWith('/node_modules/@qwik.dev/core/')) {
6263
return id;
6364
}
6465
const match = id.match(/(@builder\.io\/qwik|@qwik\.dev\/core)(.*)/);
6566
if (match) {
6667
const pkgName = match[2];
6768

6869
if (pkgName === '/build') {
69-
return `\0@qwik/build`;
70+
return `/node_modules/@qwik.dev/core/build`;
7071
}
7172
if (!pkgName || pkgName === '/jsx-runtime' || pkgName === '/jsx-dev-runtime') {
72-
return getQwik('/dist/core.mjs');
73+
return resolveQwik('/dist/core.mjs');
7374
}
7475
if (pkgName === '/server') {
75-
return getQwik('/dist/server.mjs');
76+
return resolveQwik('/dist/server.mjs');
7677
}
7778
if (pkgName.includes('/preloader')) {
78-
return getQwik('/dist/preloader.mjs');
79+
return resolveQwik('/dist/preloader.mjs');
7980
}
8081
if (pkgName.includes('/qwikloader')) {
81-
return getQwik('/dist/qwikloader.js');
82+
return resolveQwik('/dist/qwikloader.js');
8283
}
8384
if (pkgName.includes('/handlers')) {
84-
return getQwik('/handlers.mjs');
85+
return resolveQwik('/handlers.mjs');
8586
}
8687
}
8788
// Simple relative file resolution
@@ -107,8 +108,8 @@ export const replResolver = (
107108
if (input && typeof input.code === 'string') {
108109
return input.code;
109110
}
110-
if (id.startsWith('\0@qwik/')) {
111-
const path = id.slice('\0@qwik'.length);
111+
if (id.startsWith('/node_modules/@qwik.dev/core/')) {
112+
const path = id.slice('/node_modules/@qwik.dev/core'.length);
112113
if (path === '/build') {
113114
// Virtual module for Qwik build
114115
const isDev = options.buildMode === 'development';

0 commit comments

Comments
 (0)