Closed technophile-04 closed 2 months ago
This allows importing json in .ts files for example in scripts.
.ts
to test :
cd packages/hardhat
echo '{"test": "value"}' > scripts/test.json
then create a new file in scripts/test.ts and try importing it:
scripts/test.ts
import test from "./test.json"; console.log(test);
^ on main branch above should give you ts error:
"Cannot find module './test.json'. Consider using '--resolveJsonModule' to import module with '.json' extension. [2732]"
But on this branch it should work.
Also to see if script runs at runtime properly make sure you are cd packages/hardhat and then run :
yarn hardhat run scripts/test.ts
Description
This allows importing json in
.ts
files for example in scripts.to test :
then create a new file in
scripts/test.ts
and try importing it:^ on main branch above should give you ts error:
"Cannot find module './test.json'. Consider using '--resolveJsonModule' to import module with '.json' extension. [2732]"
But on this branch it should work.
Also to see if script runs at runtime properly make sure you are
cd packages/hardhat
and then run :