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..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(path.posix.join(pathToRoot, chunkPath)); + const relativeChunkPath = normalize( + chunkPath.startsWith('http') ? chunkPath : path.posix.join(pathToRoot, chunkPath), + ); preloaded.push(relativeChunkPath); } }