From 19cbcba4126309ba4776e938983f35fd95c8b368 Mon Sep 17 00:00:00 2001 From: Justin Fagnani Date: Thu, 9 May 2024 20:33:18 -0700 Subject: [PATCH 1/2] Fix rollupAdapter handling of outside-workspace imports --- packages/dev-server-rollup/src/rollupAdapter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/dev-server-rollup/src/rollupAdapter.ts b/packages/dev-server-rollup/src/rollupAdapter.ts index 8739fbbfb..5fdcd4723 100644 --- a/packages/dev-server-rollup/src/rollupAdapter.ts +++ b/packages/dev-server-rollup/src/rollupAdapter.ts @@ -253,8 +253,8 @@ export function rollupAdapter( // if the resolve import path is outside our normal root, fully resolve the file path for rollup const matches = resolvedImportPath.match(OUTSIDE_ROOT_REGEXP); if (matches) { - const upDirs = new Array(parseInt(matches[1], 10) + 1).join(`..${path.sep}`); - resolvedImportPath = `\0${path.resolve(`${upDirs}${matches[2]}`)}`; + const upDirs = new Array(parseInt(matches[1], 10)).fill('..'); + resolvedImportPath = `\0${path.resolve(rootDir, ...upDirs, matches[2])}`; } const urlParam = encodeURIComponent(resolvedImportPath); return `${VIRTUAL_FILE_PREFIX}/${filename}?${NULL_BYTE_PARAM}=${urlParam}`; From cb050eb04ae1f305774ffc31fef65cfcaf2dc9f6 Mon Sep 17 00:00:00 2001 From: Justin Fagnani Date: Fri, 10 May 2024 06:59:26 -0700 Subject: [PATCH 2/2] Add changeset --- .changeset/stale-houses-attack.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/stale-houses-attack.md diff --git a/.changeset/stale-houses-attack.md b/.changeset/stale-houses-attack.md new file mode 100644 index 000000000..bbd3c6aa4 --- /dev/null +++ b/.changeset/stale-houses-attack.md @@ -0,0 +1,5 @@ +--- +'@web/dev-server-rollup': patch +--- + +Make rollupAdapter handle the rootDir config setting