Configuration - chung-leong/zigar GitHub Wiki
Configuration file for node-zigar and bun-zigar
Node-zigar looks for node-zigar.config.json
in the parent directories of a Zig file. The config
file is used during development only. You should omit it when deploying an app.
For bun-zigar, the configuration is stored in bun-zigar.toml
instead.
Configuration for zigar-loader
Options are stored in the options
field of the rule matching .zig files. Example:
module: {
rules: [
{
test: /\.zig$/,
exclude: /node_modules/,
use: {
loader: 'zigar-loader',
options: {
embedWASM: false,
},
},
},
/* ... */
],
},
If the default options are adequate, you can refer to the plugin simply by name:
module: {
rules: [
{
test: /\.zig$/,
exclude: /node_modules/,
use: 'zigar-loader',
},
/* ... */
],
},
Configuration for rollup-plugin-zigar
Options are passed to the plugin's constructor. Example:
plugins: [
zigar({
optimize: 'ReleaseSmall',
embedWASM: true,
}),
nodeResolve(),
],
Specifying options as GET variables
You can attach options to the path in require
or import
statements. Example:
import { sha1 } from '../zig/sha1.zig?optimize=release-fast&embed-wasm=1';
Options specified in this manner take precedence. Names in kebab-case and snake_case, in addition to camelCase ones, are recognized.
Options for node-zigar, bun-zigar, zigar-loader, and rollup-plugin-zigar
buildDir
buildDirSize
clean
evalBranchQuota
multithreaded
omitFunctions
omitVariables
optimize
useLibc
zigArgs
zigPath