Skip to content

Commit

Permalink
fix artifact imports
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed May 15, 2024
1 parent 94f14b1 commit 4f26247
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions packages/cli/src/utils/getContractArtifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { LibraryPlaceholder } from "../deploy/common";
import { findPlaceholders } from "./findPlaceholders";
import { z } from "zod";
import { Abi as abiSchema } from "abitype/zod";
import { createRequire } from "node:module";

const require = createRequire(process.cwd());

export type GetContractArtifactOptions = {
/**
Expand Down Expand Up @@ -46,13 +49,7 @@ export async function getContractArtifact({
}: GetContractArtifactOptions): Promise<GetContractArtifactResult> {
let importedArtifact;
try {
importedArtifact = (
await import(artifactPath, {
with: { type: "json" },
// `with` is the new approach, but `assert` is kept for backwards-compatibility with Node 18
assert: { type: "json" },
})
).default;
importedArtifact = require(artifactPath);
} catch (error) {
console.error();
console.error("Could not import contract artifact at", artifactPath);
Expand Down
2 changes: 1 addition & 1 deletion test/mock-game-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"build": "mud build",
"clean": "forge clean && rimraf src/codegen",
"deploy:local": "mud deploy"
"deploy:local": "DEBUG=mud:* mud deploy"
},
"devDependencies": {
"@latticexyz/cli": "workspace:*",
Expand Down

0 comments on commit 4f26247

Please sign in to comment.