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/*.
Available plugins
Section titled “Available plugins”| 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-bundlertevm/bundler/compilertevm/bundler/configtevm/bundler/solc
tevm.config.json
Section titled “tevm.config.json”Place tevm.config.json at the project root to configure Foundry integration, Solidity library search paths, custom remappings, and artifact caching:
{ "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. |
TypeScript IDE plugin (@tevm/ts-plugin)
Section titled “TypeScript IDE plugin (@tevm/ts-plugin)”Enable live editor types, go-to-definition, and NatSpec hover on .sol imports:
{ "compilerOptions": { "plugins": [{ "name": "@tevm/ts-plugin" }] }}In VS Code, select Use Workspace Version under TypeScript: Select TypeScript Version.
.sol vs .s.sol bytecode emission
Section titled “.sol vs .s.sol bytecode emission”*.sol: Emits ABI and typedread/write/eventsaction creators only (smallest bundle for frontend apps).*.s.sol: Includes deployable creationbytecodeanddeployedBytecodealongside ABI types (for tests, scripts, and in-process deployment).
Codegen alternative (npx tevm gen)
Section titled “Codegen alternative (npx tevm gen)”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:
npx tevm genTroubleshooting
Section titled “Troubleshooting”- Red underlines on
.solimports in VS Code: Confirm@tevm/ts-pluginis intsconfig.jsonand VS Code is using the workspace TypeScript version. - Unresolved Solidity import: Check
libsandremappingsintevm.config.json, or set"foundryProject": trueif usingfoundry.toml/remappings.txt. - Stale compiled output: Delete
.tevm/and rebuild. - Standalone bundler docs: See bundler.tevm.sh for full plugin internals.

