Skip to content

Commit

Permalink
Revert "Revert "use import.meta.url for correct absolute import""
Browse files Browse the repository at this point in the history
This reverts commit 126b9cc.
  • Loading branch information
Justin Mancusi committed Oct 9, 2023
1 parent c86e568 commit 5760c55
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/pages/src/common/src/template/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand All @@ -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 <head> tag. It also provides validation.
Expand Down
Binary file modified packages/pages/yext-pages-1.0.0-rc.2.1.tgz
Binary file not shown.

0 comments on commit 5760c55

Please sign in to comment.