I'm using truffle development environment for prototype contract development and I need to change compiler setting (e.g. turn optimization on and off).

The documentation for the development environment does not say how to control the compiler settings. How do I do so?


The configurations for the compiler settings can be found in the advanced section of the documentation:

You will need to update your truffle.js configuration file to include the following:

module.exports = {
    solc: {
      settings: {
        optimizer: {
          enabled: true,
          runs: 1500
  • weird, keyword search missed this a week ago. thanks! I tested the settings and gasUsed changed, so looks correct.
    – Paul S
    Sep 7 '17 at 17:21
  • 2
    ROFL didn't find it a week ago because you just added it. Thanks! github.com/trufflesuite/trufflesuite.github.io/commit/…
    – Paul S
    Sep 7 '17 at 17:27
  • Is there a way to compile only current directory?
    – sensei
    May 22 '18 at 9:55
  • @JohnMathilda ask that as a standalone question please.
    – Paul S
    May 31 '18 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.