Registry / testing / vite-plugin-satteri

vite-plugin-satteri

JSON →
library0.2.7jsnpmunverified

Vite plugin for processing Markdown (.md) and MDX (.mdx) files using Sätteri. Version 0.2.7, active development. Integrates with Vite 5, 6, 7, or 8. Imports .md files as HTML strings with optional frontmatter exports, and .mdx files as JSX components. Supports GFM, frontmatter, math, and custom mdast/hast plugins. Unlike other MDX plugins, it relies on the Sätteri ecosystem and allows shared remark/rehype plugins across both Markdown and MDX pipelines.

npm install vite-plugin-satteri
INSTALL
IMPORT
SIG · VITE-PLUGIN-SATTER
V
vite-plugin-satteri
testingjavascriptv0.2.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (plugin factory)
import satteri from 'vite-plugin-satteri'
const satteri = require('vite-plugin-satteri')
ESM-only; default export is the plugin factory function.
Markdown default HTML export
import html from './post.md'
import { default as html } from './post.md' (unnecessary)
.md files export default as HTML string; named 'html' export also exists.
Markdown named frontmatter export
import { frontmatter } from './post.md'
Only available if frontmatter feature is enabled.
MDX default component export
import MDXContent from './intro.mdx'
import { MDXContent } from './intro.mdx' (incorrect named import)
MDX files export default as a JSX component. Named exports include frontmatter.
Type augmentation for .md/.mdx
declare module '*.md' { const html: string; ... }
User must manually add type declarations for Vite to understand module types.

Configures Vite with the plugin, imports a .md file for HTML and frontmatter, and imports an .mdx file as a component.

// vite.config.ts import { defineConfig } from 'vite'; import satteri from 'vite-plugin-satteri'; export default defineConfig({ plugins: [ satteri({ features: { gfm: true, frontmatter: true, }, }), ], }); // In a component: import postHtml, { frontmatter } from './post.md'; import MDXContent from './intro.mdx'; // Use postHtml as innerHTML, and MDXContent as JSX component.
Debug
Known issues
breakingSatteri v0.x breaking changes: API may change between minor versions. Check changelog before upgrading.
fix
Pin specific version and review release notes.
affects: <1.0
gotcha.mdx files require a JSX runtime; ensure you have one installed (e.g., @preact/preset-vite or @vitejs/plugin-react).
fix
Add the appropriate Vite plugin for your framework.
affects: >=0.0
deprecatedThe 'mdx.dev' option is deprecated; use 'mdx.development' instead.
fix
Use 'satteri({ mdx: { development: true } })' in config.
affects: <0.2.0
gotchaTypeScript does not automatically recognize .md/.mdx modules. You must provide global type declarations.
fix
Add a .d.ts file with module declarations for '*.md' and '*.mdx' as shown in the README.
affects: >=0.0
breakingVite 4 is not supported; requires vite ^5 || ^6 || ^7 || ^8.
fix
Upgrade Vite to version 5 or higher.
affects: >=0.0
Errors
Common errors & fixes
Cannot find module '...' or its corresponding type declarations.
Missing type declarations for .md/.mdx imports.
fix
Create a .d.ts file with module declarations as shown in README.
Uncaught Error: [satteri] Could not resolve JSX runtime.
MDX files require a JSX runtime (e.g., Preact, React) but none is configured.
fix
Install and configure a Vite plugin for your framework (e.g., @vitejs/plugin-react).
UnhandledPromiseRejectionWarning: Error: [satteri] Cannot use import statement outside a module.
CommonJS require() used to import the ESM-only plugin.
fix
Use ESM imports (import) or set type: 'module' in package.json.
Upgrade
Version history
0.2.7latest on npm
Audit
Dependencies
satterirequiredCore Markdown/MDX processor; peer dependency.
viterequiredBuild tool integration; peer dependency.
Agent activity
4 hits · last 30 days
node
4
Resources
vite-plugin-satteri — npm install vite-plugin-satteri · libregistry