Skip to content

Fix package manager import issues #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/@apphosting/adapter-angular/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import {
buildManifestSchema,
ValidManifest,
} from "./interface.js";
import { createRequire } from "node:module";
import stripAnsi from "strip-ansi";

// fs-extra is CJS, readJson can't be imported using shorthand
export const { writeFile, move, readJson, mkdir, copyFile } = fsExtra;

const require = createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const SIMPLE_SERVER_FILE_PATH = join(__dirname, "simple-server", "bundled_server.mjs");
Expand All @@ -31,10 +33,11 @@ export const REQUIRED_BUILDER = "@angular-devkit/build-angular:application";
export async function checkStandaloneBuildConditions(cwd: string): Promise<void> {
// dynamically load Angular so this can be used in an NPX context
const { NodeJsAsyncHost }: typeof import("@angular-devkit/core/node") = await import(
`${cwd}/node_modules/@angular-devkit/core/node/index.js`
// TODO (sijinli): resolve paths under cwd to be safer later
require.resolve("@angular-devkit/core/node/index.js")
);
const { workspaces }: typeof import("@angular-devkit/core") = await import(
`${cwd}/node_modules/@angular-devkit/core/src/index.js`
require.resolve("@angular-devkit/core/src/index.js")
);

const host = workspaces.createWorkspaceHost(new NodeJsAsyncHost());
Expand Down