diff --git a/packages/hydrogen/src/framework/plugins/vite-plugin-react-server-components-shim.ts b/packages/hydrogen/src/framework/plugins/vite-plugin-react-server-components-shim.ts index fa54f67..9807d90 100644 --- a/packages/hydrogen/src/framework/plugins/vite-plugin-react-server-components-shim.ts +++ b/packages/hydrogen/src/framework/plugins/vite-plugin-react-server-components-shim.ts @@ -79,9 +79,12 @@ export default () => { const importerToRootPath = path.relative(importerPath, config.root); const [importerToRootNested] = - importerToRootPath.match(/(\.\.\/)+/) || []; + importerToRootPath.match(/(\.\.\/)+(\.\.)?/) || []; const userPrefix = path.normalize( - path.join(importerPath, importerToRootNested) + path.join( + importerPath, + importerToRootNested.replace(/\/?$/, path.sep) + ) ); const userGlob = path.join( importerToRootPath,