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.
default
✓ import prettierPluginReact from 'prettier-plugin-react'
✗ const prettierPluginReact = require('prettier-plugin-react')
ESM-only; no CJS support.
options
✓ import { options } from 'prettier-plugin-react'
Named export for plugin options object.
Plugin
✓ import type { Plugin } from 'prettier-plugin-react'
✗ import { Plugin } from 'prettier-plugin-react'
TypeScript: use `import type` to avoid runtime import.
Shows how to use the plugin with Prettier API to format JSX code with custom options.
import prettier from 'prettier';
import prettierPluginReact from 'prettier-plugin-react';
const code = `const App = () => <div>Hello</div>;`;
prettier.format(code, {
parser: 'babel',
plugins: [prettierPluginReact],
jsxSingleQuote: true,
}).then(result => console.log(result));
// Output: const App = () => <div>Hello</div>;
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported.
Using CommonJS require() on ESM-only package.
fixUse `import prettierPluginReact from 'prettier-plugin-react'` or dynamic import.
TypeError: prettierPluginReact is not a plugin
Plugin not included in plugins array or wrong import.
fixEnsure plugin is imported and passed in `plugins` array when calling prettier.format.
Audit
Dependencies
No dependency data recorded yet.