diff --git a/packages/hydrogen/CHANGELOG.md b/packages/hydrogen/CHANGELOG.md index 1c59e51d06..833707fa8f 100644 --- a/packages/hydrogen/CHANGELOG.md +++ b/packages/hydrogen/CHANGELOG.md @@ -5,7 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - +## Unreleased + +- fix: add trailing slash to user components glob ## 0.6.2 - 2021-11-10 diff --git a/packages/hydrogen/src/framework/Hydration/client-imports.ts b/packages/hydrogen/src/framework/Hydration/client-imports.ts index e711e271cd..e0a0f9222b 100644 --- a/packages/hydrogen/src/framework/Hydration/client-imports.ts +++ b/packages/hydrogen/src/framework/Hydration/client-imports.ts @@ -25,7 +25,7 @@ const allClientComponents = { ), }; -export default function importDevClientComponent(moduleId: string) { +export default function importClientComponent(moduleId: string) { const modImport = allClientComponents[moduleId]; if (!modImport) { 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 fa54f673b4..9807d90a64 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,