{"id":22298,"library":"rollup-plugin-zigar","title":"Zigar Rollup Plugin","description":"A Rollup plugin (v0.15.2) that transpiles Zig source code into JavaScript/WASM, enabling Zig to be used as a dependency in web bundles. Released as part of the Zigar toolchain, it compiles Zig to WebAssembly and generates JS wrappers for seamless import in Rollup-based projects. Rapidly evolving (pre-1.0). Differentiates from Emscripten by targeting direct Zig compilation for bundlers.","status":"active","version":"0.15.2","language":"javascript","source_language":"en","source_url":"https://github.com/chung-leong/zigar","tags":["javascript","zig","rollup-plugin"],"install":[{"cmd":"npm install rollup-plugin-zigar","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-zigar","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-zigar","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: requires Rollup >=2.0 for plugin interface","package":"rollup","optional":false},{"reason":"Used for file filtering and ID resolution","package":"@rollup/pluginutils","optional":true}],"imports":[{"note":"ESM-only; CJS require will fail.","wrong":"const zigar = require('rollup-plugin-zigar')","symbol":"default","correct":"import zigar from 'rollup-plugin-zigar'"},{"note":"Named export is exactly 'zigar', not 'zigarPlugin'.","wrong":"import { zigarPlugin } from 'rollup-plugin-zigar'","symbol":"zigar","correct":"import { zigar } from 'rollup-plugin-zigar'"}],"quickstart":{"code":"// rollup.config.js\nimport zigar from 'rollup-plugin-zigar';\n\nexport default {\n  input: 'src/main.js',\n  output: {\n    dir: 'dist',\n    format: 'esm',\n  },\n  plugins: [\n    zigar({\n      // optional: specify Zig compiler path\n      // zigPath: '/usr/local/bin/zig',\n    }),\n  ],\n};","lang":"javascript","description":"Shows how to integrate the Zigar plugin into a Rollup config to transpile Zig imports (e.g., from .zig files) into JavaScript modules."},"warnings":[{"fix":"Pass an empty object explicitly: zigar({}).","message":"Zigar v0.15 changed the plugin API: options object is no longer optional; zigar() now requires a config argument.","severity":"breaking","affected_versions":">=0.15.0"},{"fix":"Upgrade to Node.js 14+ and use ESM imports (i.e., package.json type: module or .mjs extension).","message":"Node.js <14 are unsupported in v0.14+. ESM-only distribution removed CJS support.","severity":"breaking","affected_versions":">=0.14.0"},{"fix":"Update Rollup to 3.x or later.","message":"Support for Rollup <3 is deprecated; future versions will require Rollup 3+.","severity":"deprecated","affected_versions":">=0.13.0"},{"fix":"Ensure your Zig source exports a pub fn main() or pub fn exportedFunction() callable from JS.","message":"Plugin only works with .zig files that export a main function. Exported functions must be public and have compatible signatures for WASM.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'-1.0':53 'base':48 'bundl':25 'bundler':63 'code':12 'compil':34,61 'depend':22 'differenti':54 'direct':59 'emscripten':56 'enabl':15 'evolv':51 'generat':39 'import':44 'javascript':64 'javascript/wasm':14 'js':40 'part':28 'plugin':3,6,68 'pre':52 'project':49 'rapid':50 'releas':26 'rollup':2,5,47,67 'rollup-bas':46 'rollup-plugin':66 'seamless':43 'sourc':11 'target':58 'toolchain':32 'transpil':9 'use':19 'v0.15.2':7 'web':24 'webassembl':37 'wrapper':41 'zig':10,16,35,60,65 'zigar':1,31","created_at":"2026-04-27T17:04:26.319503+00:00","updated_at":"2026-04-27T17:04:26.319503+00:00","problems":[{"fix":"Ensure the zigar plugin is included in the plugins array of your Rollup config.","cause":"Rollup cannot handle .zig files without the plugin or the plugin is not configured.","error":"Error: Could not resolve './foo.zig' from 'src/bar.js'"},{"fix":"Check that your project uses ESM (type: module in package.json) and Node.js >=14.","cause":"Default import fails if package is not resolved correctly, possibly due to missing ESM support.","error":"TypeError: zigar is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/chung-leong/zigar","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-zigar","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}