From b3f73130d7cf18b6d46445fb47d87582767309ae Mon Sep 17 00:00:00 2001 From: thepassle Date: Tue, 25 Mar 2025 15:39:48 +0100 Subject: [PATCH 1/2] fix: dont call path.join on external urls, it breaks them --- .changeset/green-peas-sit.md | 5 +++++ .../src/rollupPluginPolyfillsLoader.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/green-peas-sit.md diff --git a/.changeset/green-peas-sit.md b/.changeset/green-peas-sit.md new file mode 100644 index 000000000..b1f9b3975 --- /dev/null +++ b/.changeset/green-peas-sit.md @@ -0,0 +1,5 @@ +--- +'@web/rollup-plugin-polyfills-loader': patch +--- + +dont path.join on external urls, it breaks them diff --git a/packages/rollup-plugin-polyfills-loader/src/rollupPluginPolyfillsLoader.ts b/packages/rollup-plugin-polyfills-loader/src/rollupPluginPolyfillsLoader.ts index 5478f363f..56e3d4716 100644 --- a/packages/rollup-plugin-polyfills-loader/src/rollupPluginPolyfillsLoader.ts +++ b/packages/rollup-plugin-polyfills-loader/src/rollupPluginPolyfillsLoader.ts @@ -88,7 +88,7 @@ export function polyfillsLoader(pluginOptions: RollupPluginPolyfillsLoaderConfig // js files (incl. chunks) will always be in the root directory const pathToRoot = path.posix.dirname(importPath); for (const chunkPath of entrypoint.chunk.imports) { - const relativeChunkPath = normalize(path.posix.join(pathToRoot, chunkPath)); + const relativeChunkPath = normalize(chunkPath.startsWith('http') ? chunkPath : path.posix.join(pathToRoot, chunkPath)); preloaded.push(relativeChunkPath); } } From c9b0f2b31da376299076621b1131f627761985f9 Mon Sep 17 00:00:00 2001 From: thepassle Date: Tue, 25 Mar 2025 15:49:44 +0100 Subject: [PATCH 2/2] chore: format --- .../src/rollupPluginPolyfillsLoader.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/rollup-plugin-polyfills-loader/src/rollupPluginPolyfillsLoader.ts b/packages/rollup-plugin-polyfills-loader/src/rollupPluginPolyfillsLoader.ts index 56e3d4716..7fe208599 100644 --- a/packages/rollup-plugin-polyfills-loader/src/rollupPluginPolyfillsLoader.ts +++ b/packages/rollup-plugin-polyfills-loader/src/rollupPluginPolyfillsLoader.ts @@ -88,7 +88,9 @@ export function polyfillsLoader(pluginOptions: RollupPluginPolyfillsLoaderConfig // js files (incl. chunks) will always be in the root directory const pathToRoot = path.posix.dirname(importPath); for (const chunkPath of entrypoint.chunk.imports) { - const relativeChunkPath = normalize(chunkPath.startsWith('http') ? chunkPath : path.posix.join(pathToRoot, chunkPath)); + const relativeChunkPath = normalize( + chunkPath.startsWith('http') ? chunkPath : path.posix.join(pathToRoot, chunkPath), + ); preloaded.push(relativeChunkPath); } }