Skip to content

Commit

Permalink
better sanitize Rollup importer for standard file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Jan 19, 2025
1 parent 00f12fc commit 1ebc0cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as walk from 'acorn-walk';

// https://github.com/rollup/rollup/issues/2121
// would be nice to get rid of this
function cleanRollupId(id) {
function cleanRollupId(id = '') {
return id.replace('\x00', '').replace('?commonjs-proxy', '');
}

Expand All @@ -27,7 +27,7 @@ function greenwoodResourceLoader (compilation, browser = false) {
async resolveId(id, importer, options) {
const { userWorkspace, scratchDir } = compilation.context;
const normalizedId = cleanRollupId(id);
const importerUrl = new URL(`file://${importer ?? ''}`);
const importerUrl = new URL(`file://${cleanRollupId(importer) ?? ''}`);
const isUserWorkspaceImporter = importerUrl?.pathname?.startsWith(userWorkspace.pathname);
const isScratchDirImporter = importerUrl?.pathname?.startsWith(scratchDir.pathname);

Expand Down

0 comments on commit 1ebc0cf

Please sign in to comment.