From 0a339968fe1fe54163765abec7f8f429ac954be1 Mon Sep 17 00:00:00 2001 From: Pierre Dubois Date: Fri, 13 Sep 2024 09:54:47 -0400 Subject: [PATCH] build: Fix npm build on MS window native (#630) Fix build on window native --- packages/react-ssr/scripts/build.ts | 6 +++++- .../__tests__/generate-value-accessors.spec.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/react-ssr/scripts/build.ts b/packages/react-ssr/scripts/build.ts index 674c0d96a..32c8a2357 100644 --- a/packages/react-ssr/scripts/build.ts +++ b/packages/react-ssr/scripts/build.ts @@ -30,7 +30,11 @@ const createReactWrapperModules = async ({ entryPoints, distRoot }) => { const enums = parseEnums(componentsTypeSource); let i = 0; - for (const importPath of entryPoints) { + for (let importPath of entryPoints) { + + // Build on Window: File prefix required + importPath = importPath.replace( /^[A-Z]:\\/, 'file://$&' ); + const component = await import(importPath); let defineFunctionName = 'd'; diff --git a/utils/angular-output-target/__tests__/generate-value-accessors.spec.ts b/utils/angular-output-target/__tests__/generate-value-accessors.spec.ts index 0fb466cd9..8001d9537 100644 --- a/utils/angular-output-target/__tests__/generate-value-accessors.spec.ts +++ b/utils/angular-output-target/__tests__/generate-value-accessors.spec.ts @@ -41,6 +41,6 @@ export class TextValueAccessor extends ValueAccessor { super(el); } }`; - expect(finalText.trim()).toEqual(exptectedOutput.trim().replace(/\n/g, EOL)); + expect(finalText.trim().replace(/\r/g, "").replace(/\n/g, EOL)).toEqual(exptectedOutput.trim().replace(/\n/g, EOL)); }); });