Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
none
✓ npx prettier --write *.wgsl
✗ require('prettier-plugin-wgsl')
This is a Prettier plugin, not a Node.js module. It is used via Prettier CLI or API by adding to plugins array.
prettier-plugin-wgsl
✓ plugins: ['prettier-plugin-wgsl']
✗ require('prettier-plugin-wgsl')
In Prettier config file (JSON or JS), add the package name to the plugins array.
prettier
✓ const prettier = require('prettier'); await prettier.format(code, { parser: 'wgsl', plugins: ['prettier-plugin-wgsl'] })
✗ const prettier = require('prettier-plugin-wgsl')
Use Prettier's API with plugin installed; specify parser: 'wgsl' to format WGSL code.
Shows how to install and configure the plugin, then format a WGSL file via CLI.
// Install: npm install --save-dev prettier prettier-plugin-wgsl
// Add to .prettierrc:
{
"plugins": ["prettier-plugin-wgsl"],
"semi": true
}
// Format a file:
// npx prettier --write shader.wgsl
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-wgsl'
The plugin is not installed or not in node_modules.
fixRun npm install --save-dev prettier-plugin-wgsl
Couldn't resolve parser 'wgsl'
Prettier is older than 3.0.0 or plugin not loaded.
fixUpdate Prettier to >=3.0.0 and add plugin to plugins config.
Uncaught SyntaxError: Unexpected token
WGSL syntax not supported by the plugin version.
fixUpdate the plugin to latest version or report the issue on GitHub.
Audit
Dependencies
prettierrequiredpeer dependency: required to run as a Prettier plugin