diff --git a/packages/pages/src/common/src/template/hydration.ts b/packages/pages/src/common/src/template/hydration.ts index cc63f0635..204c7b788 100644 --- a/packages/pages/src/common/src/template/hydration.ts +++ b/packages/pages/src/common/src/template/hydration.ts @@ -65,8 +65,11 @@ export const getHydrationTemplate = ( const posixModulePath = convertToPosixPath(templateModulePath); const posixRenderPath = convertToPosixPath(clientRenderTemplatePath); return ` - const component = await import("/${posixModulePath}"); - const render = await import("/${posixRenderPath}"); + const componentURL = new URL("/${posixModulePath}", import.meta.url) + const component = await import(componentURL); + + const renderURL = new URL("/${posixRenderPath}", import.meta.url) + const render = await import(renderURL); render.render( { @@ -77,6 +80,13 @@ export const getHydrationTemplate = ( `; }; +const makeAbsolute = (path: string): string => { + if (!path.startsWith("/")) { + return "/" + path; + } + return path; +}; + /** * Get the server template with injected html common to both the dev and plugin side of things. * For the most part, injects data into the tag. It also provides validation. diff --git a/packages/pages/yext-pages-1.0.0-rc.2.1.tgz b/packages/pages/yext-pages-1.0.0-rc.2.1.tgz index 37adbf4da..afe096cb1 100644 Binary files a/packages/pages/yext-pages-1.0.0-rc.2.1.tgz and b/packages/pages/yext-pages-1.0.0-rc.2.1.tgz differ