Skip to content

Bundler plugins

TEVM bundler plugins compile .sol and .s.sol imports into typed ES modules at build time using @tevm/base-bundler and solc. The bundler packages live in evmts/tevm-bundler and are re-exported under tevm/bundler/*.

Bundler Umbrella subpath Export Usage
Vite tevm/bundler/vite-plugin vitePluginTevm vitePluginTevm()
esbuild tevm/bundler/esbuild-plugin esbuildPluginTevm esbuildPluginTevm()
Rollup tevm/bundler/rollup-plugin rollupPluginTevm rollupPluginTevm()
Webpack tevm/bundler/webpack-plugin WebpackPluginTevm new WebpackPluginTevm()
Rspack tevm/bundler/rspack-plugin rspackPluginTevm rspackPluginTevm()
Bun tevm/bundler/bun-plugin bunPluginTevm plugin(bunPluginTevm({}))

Additional lower-level subpaths re-exported from tevm:

  • tevm/bundler/base-bundler
  • tevm/bundler/compiler
  • tevm/bundler/config
  • tevm/bundler/solc

Place tevm.config.json at the project root to configure Foundry integration, Solidity library search paths, custom remappings, and artifact caching:

tevm.config.json
{
"foundryProject": true,
"libs": ["./lib", "./node_modules"],
"remappings": {
"@openzeppelin/": "node_modules/@openzeppelin/"
},
"debug": false,
"cacheDir": ".tevm",
"jsonAsConst": ["**/*.abi.json"]
}
Option Type Default Description
foundryProject boolean | string false Set true to load foundry.toml automatically, or pass a path to a Foundry config file.
libs string[] [] Additional library directories searched for Solidity imports.
remappings Record<string, string> {} Explicit Solidity import prefix remappings.
cacheDir string '.tevm' Directory for compiled contract cache artifacts. Add .tevm/ to .gitignore.
debug boolean false Write extra diagnostic artifacts inside cacheDir.
jsonAsConst string | string[] [] Glob patterns for JSON ABI files typed as const.

Enable live editor types, go-to-definition, and NatSpec hover on .sol imports:

tsconfig.json
{
"compilerOptions": {
"plugins": [{ "name": "@tevm/ts-plugin" }]
}
}

In VS Code, select Use Workspace Version under TypeScript: Select TypeScript Version.

  • *.sol: Emits ABI and typed read / write / events action creators only (smallest bundle for frontend apps).
  • *.s.sol: Includes deployable creation bytecode and deployedBytecode alongside ABI types (for tests, scripts, and in-process deployment).

If your build pipeline runs standalone tsc checks that do not load TypeScript language service plugins (such as Next.js production builds), pre-generate .ts modules next to each Solidity file:

Terminal window
npx tevm gen
  • Red underlines on .sol imports in VS Code: Confirm @tevm/ts-plugin is in tsconfig.json and VS Code is using the workspace TypeScript version.
  • Unresolved Solidity import: Check libs and remappings in tevm.config.json, or set "foundryProject": true if using foundry.toml / remappings.txt.
  • Stale compiled output: Delete .tevm/ and rebuild.
  • Standalone bundler docs: See bundler.tevm.sh for full plugin internals.