npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nomicfoundation/hardhat-slang-solx

v3.0.4

Published

Hardhat plugin for using solx compiler in test builds

Readme

Hardhat Slang Solx plugin

This plugin enables the slang-solx Solidity compiler in Hardhat. slang-solx is a Solidity compiler based on solc and LLVM. It compiles faster, produces better optimized bytecode, and gets rid of “stack too deep” errors.

The slang-solx compiler is currently experimental and is not ready for production use-cases. We recommend using the compiler for test builds and test execution locally, and continuing to use solc for production use-cases (including during deployment, for example with hardhat-ignition and in your CI). Care should be taken before enabling compilation with slang-solx in other build profiles, see configuration flags below.

The compiler was originally developed at Matter Labs under the name solx. It moved to the Nomic Foundation in 2025, where it was renamed slang-solx. Its repository and release assets still use the solx name.

💡 Tip: Read the Compiling with slang-solx guide for more details.

Installation

npm install --save-dev @nomicfoundation/hardhat-slang-solx

Then add the plugin to your hardhat.config.ts and create a slang-solx build profile. You must use the build profiles config format, which requires both a default and a slang-solx profile:

import { defineConfig } from "hardhat/config";
import hardhatSlangSolx from "@nomicfoundation/hardhat-slang-solx";

export default defineConfig({
  plugins: [hardhatSlangSolx],
  solidity: {
    profiles: {
      default: {
        version: "0.8.29",
      },
      "slang-solx": {
        type: "slang-solx",
        version: "0.8.34",
      },
    },
  },
});

The default profile uses solc as usual. The slang-solx profile uses the slang-solx compiler, identified by type: "slang-solx". Your .sol files should have compatible pragmas, for example pragma solidity ^0.8.29;. Strict pragmas for unsupported Solidity versions, for example pragma solidity 0.8.28;, will currently not compile with the hardhat-slang-solx plugin. See more details below for the currently supported Solidity versions and EVM versions.

Usage

Run tests or compile using the slang-solx build profile:

hardhat test --build-profile slang-solx
hardhat build --build-profile slang-solx

The default profile continues to use solc as usual:

hardhat build    # uses solc (default profile)

Configuration

Multi-version example

You can configure the slang-solx profile with multiple compilers. Compilers without type: "slang-solx" will use solc:

export default defineConfig({
  plugins: [hardhatSlangSolx],
  solidity: {
    profiles: {
      default: {
        compilers: [{ version: "0.8.34" }, { version: "0.8.20" }],
      },
      "slang-solx": {
        compilers: [
          { type: "slang-solx", version: "0.8.34" },
          { version: "0.8.20" }, // uses solc, slang-solx doesn't support this version
        ],
      },
    },
  },
});

Options

  • dangerouslyAllowSlangSolxInProduction (boolean, default: false), allows compiler type "slang-solx" in build profiles other than slang-solx. By default, using type: "slang-solx" in any other profile (e.g. default, production) will produce a validation error.
export default defineConfig({
  plugins: [hardhatSlangSolx],
  solidity: {
    profiles: {
      default: {
        type: "slang-solx", // allowed only because of the option below
        version: "0.8.34",
      },
      "slang-solx": {
        type: "slang-solx",
        version: "0.8.34",
      },
    },
  },
  "slang-solx": {
    dangerouslyAllowSlangSolxInProduction: true,
  },
});

Optimization level

slang-solx optimizes via LLVM; set the level per profile with settings.optimizer.mode:

| Mode | What it does | | ----- | ----------------------------------------------------- | | "1" | Least optimization, fastest to compile (the default). | | "2" | More runtime optimization. | | "3" | Best runtime performance. | | "s" | Smaller bytecode. | | "z" | Smallest bytecode. |

slang-solx has two independent optimizer knobs:

  • optimizer.mode (above) is the LLVM backend level. There is no "off" — the minimum is "1", so LLVM always optimizes.
  • optimizer.enabled is the embedded solc front end's own optimizer, false by default. It only affects the legacy pipeline, where it optimizes the EVM assembly slang-solx translates. Under viaIR: true it changes nothing but the metadata hash: slang-solx bypasses the Yul optimizer entirely, so the IR handed to LLVM is always unoptimized.

For example, optimizing for size instead of performance:

import { defineConfig } from "hardhat/config";
import hardhatSlangSolx from "@nomicfoundation/hardhat-slang-solx";

export default defineConfig({
  plugins: [hardhatSlangSolx],
  solidity: {
    profiles: {
      default: { version: "0.8.34" },
      "slang-solx": {
        type: "slang-solx",
        version: "0.8.34",
        settings: { optimizer: { mode: "z" } }, // optimize for size
      },
    },
  },
});

Or, on the legacy pipeline, run the front end's assembly optimizer before LLVM -O3 (both knobs on) — just the slang-solx profile:

"slang-solx": {
  type: "slang-solx",
  version: "0.8.34",
  settings: { optimizer: { enabled: true, mode: "3" } },
},

Supported Solidity versions

slang-solx maps each Solidity version to a specific slang-solx binary version internally. Currently supported: 0.8.34 (solx 0.1.8). Earlier slang-solx releases did not emit the DWARF debug info that EDR relies on for Solidity stack traces, so they are not supported by this plugin.

EVM version support

slang-solx supports EVM versions cancun, prague, and osaka. Using an older EVM target (e.g., paris, shanghai) with compiler type "slang-solx" will result in a validation error.