Skip to content
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

Fix rollupAdapter handling of outside-workspace imports #2727

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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/stale-houses-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@web/dev-server-rollup': patch
---

Make rollupAdapter handle the rootDir config setting
4 changes: 2 additions & 2 deletions packages/dev-server-rollup/src/rollupAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down
Loading