【发布时间】:2022-09-26 13:18:52
【问题描述】:
我想将安全帽与nestjs一起使用并通过HRE部署合同
- 如果我使用 require 语句,插件将不起作用
- 如果我使用 import 语句,它会给出 can\'t use import outside module
部署合约的脚本
const tokenFactory = await ethers.getContractFactory(\'Token\')
const token = await tokenFactory.deploy(args)
tsconfig.json
{
\"compilerOptions\": {
\"module\": \"CommonJS\",
\"declaration\": true,
\"removeComments\": true,
\"emitDecoratorMetadata\": true,
\"experimentalDecorators\": true,
\"moduleResolution\": \"node\",
\"resolveJsonModule\": true,
\"esModuleInterop\": true,
\"allowSyntheticDefaultImports\": true,
\"target\": \"es2017\",
\"sourceMap\": true,
\"outDir\": \"./dist\",
\"baseUrl\": \"./\",
\"incremental\": true,
\"skipLibCheck\": true,
\"strictNullChecks\": false,
\"noImplicitAny\": false,
\"strictBindCallApply\": false,
\"forceConsistentCasingInFileNames\": false,
\"noFallthroughCasesInSwitch\": false
},
\"include\": [\"/**/*.ts\", \"hardhat.config.js\"],
\"files\": [\"hardhat.config.js\"]
}
安全帽配置文件
require(\'hardhat\')
require(\'hardhat-deploy\')
require(\'hardhat-deploy-ethers\')
require(\'@nomicfoundation/hardhat-toolbox\')
require(\'@nomiclabs/hardhat-ethers\')
require(\'dotenv\').config()
module.exports = {
solidity: \'0.8.15\',
---- NETWORKS SECTION ----
paths: {
sources: \'tokens\'
}
}
标签: typescript nestjs blockchain hardhat