Skip to content
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

Always use npm or pnpm to set the package type to module #6371

Merged
merged 1 commit into from
Feb 20, 2025
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
9 changes: 8 additions & 1 deletion v-next/hardhat/src/internal/cli/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,14 @@ export async function validatePackageJson(

const packageManager = await getPackageManager(workspace);

await spawn(packageManager, ["pkg", "set", "type=module"], {
// We know this works with npm, pnpm, but not with yarn. If, so we use
// pnpm or npm exclusively.
// If you read this comment and wonder if this is outdated, you can
// answer it by checking if the most popular versions of yarn and other
// package managers support `<package manager> pkg set type=module`.
const packageManagerToUse = packageManager === "pnpm" ? "pnpm" : "npm";

await spawn(packageManagerToUse, ["pkg", "set", "type=module"], {
cwd: workspace,
shell: true,
stdio: "inherit",
Expand Down
Loading