From cb88e15b333f40f3fe19bb3b5662f5f1c9d2b7e4 Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Wed, 3 Mar 2021 16:01:54 +0100 Subject: [PATCH] Enable optimizations when publishing package (#2557) (cherry picked from commit 618a73581677b6f9563d3a97fc4bbe93e8dcbd8f) --- hardhat.config.js | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hardhat.config.js b/hardhat.config.js index 2dad03553..fe6faf124 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -11,6 +11,7 @@ for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) { } const enableGasReport = !!process.env.ENABLE_GAS_REPORT; +const enableProduction = process.env.COMPILE_MODE === 'production'; /** * @type import('hardhat/config').HardhatUserConfig @@ -20,7 +21,7 @@ module.exports = { version: '0.8.0', settings: { optimizer: { - enabled: enableGasReport, + enabled: enableGasReport || enableProduction, runs: 200, }, }, diff --git a/package.json b/package.json index 395194d40..1e0bd2475 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "lint:js:fix": "eslint --ignore-path .gitignore . --fix", "lint:sol": "echo 'solidity linter currently disabled' # solhint --max-warnings 0 \"contracts/**/*.sol\"", "prepublish": "rimraf build contracts/build artifacts cache", - "prepare": "npm run compile", + "prepare": "env COMPILE_MODE=production npm run compile", "prepack": "scripts/prepack.sh", "release": "scripts/release/release.sh", "version": "scripts/release/version.sh",