Registry / web-framework / what-compiler

what-compiler

JSON →
library0.8.1jsnpmunverified

JSX compiler for What Framework. Transforms JSX into optimized DOM operations via a Babel plugin or Vite plugin. Current stable version is 0.8.1. Development is active with frequent releases. Key differentiators: file-based routing via virtual module, production optimizations, and significant performance improvements (e.g., DOM rendering pipeline optimizations). Compared to other JSX compilers like babel-plugin-transform-react-jsx, it is tightly integrated with What Framework and provides virtual routing.

npm install what-compiler
INSTALL
IMPORT
SIG · WHAT-COMPILER
W
what-compiler
web-frameworkjavascriptv0.8.1
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.

vitePlugin|what
✓ import { what } from 'what-compiler/vite'
✗ import what from 'what-compiler/vite'
The Vite plugin is exported as a named export (what or vitePlugin). Default import is not available.
babelPlugin
✓ import { babelPlugin } from 'what-compiler/babel'
✗ import babelPlugin from 'what-compiler/babel'
Babel plugin is a named export.
routes
✓ import { routes } from 'virtual:what-routes'
✗ import routes from 'what-compiler/virtual-routes'
Routes are generated at build time from a virtual module, not from the package itself.
scanPages
✓ import { scanPages } from 'what-compiler/file-router'
✗ const scanPages = require('what-compiler/file-router').scanPages
Package is ESM-only, CommonJS require() will fail.

Configures Vite plugin with file-based routing, then mounts app with routes.

// vite.config.js import { defineConfig } from 'vite'; import { what } from 'what-compiler/vite'; export default defineConfig({ plugins: [ what({ pages: './src/pages', production: process.env.NODE_ENV === 'production', }), ], }); // src/App.jsx import { mount } from 'what-framework'; import { routes } from 'virtual:what-routes'; import { FileRouter } from 'what-router'; const App = () => <FileRouter routes={routes} />; mount(<App />, document.getElementById('app'));
Debug
Known issues
breakingv0.7.0 changed internal DOM rendering pipeline, may affect custom rendering logic.
fix
Ensure custom rendering extensions are updated to work with the new pipeline.
affects: <0.7.0
deprecatedDeprecated 'what-compiler/runtime' subpath removed in v0.6.0.
fix
Use 'what-compiler/file-router' for file router helpers.
affects: >=0.6.0
gotchaESM-only package: require() does not work.
fix
Use import syntax; if using CommonJS, use dynamic import() or set package type to module.
affects: >=0.8.0
gotchaVirtual module 'virtual:what-routes' only exists after Vite build/start; cannot be imported directly in Node.js.
fix
Only import routes inside Vite-processed code; do not import in Node scripts outside Vite.
affects: >=0.8.0
Errors
Common errors & fixes
Cannot find module 'virtual:what-routes'
Importing virtual module outside of Vite environment (e.g., in Node script without Vite).
fix
Ensure the import is only used in code processed by Vite (e.g., inside src/).
Module not found: Error: Can't resolve 'what-compiler/vite' in '/project/vite.config.js'
Package not installed or incorrect subpath.
fix
Run 'npm install what-compiler --save-dev' and verify the import path 'what-compiler/vite' (not 'what-compiler/vite-plugin').
TypeError: what is not a function
Default import used instead of named import for Vite plugin.
fix
Use import { what } from 'what-compiler/vite'.
Error: [BABEL] ...: Plugin .default is not a valid Babel plugin
Using default import for Babel plugin instead of named export.
fix
Use import { babelPlugin } from 'what-compiler/babel'.
Error: 'require' of ES Module not supported
Using require() on an ESM-only package.
fix
Convert to ES module or use dynamic import().
Upgrade
Version history
0.8.1latest on npm
Audit
Dependencies
@babel/corerequiredPeer dependency required for Babel plugin.
what-corerequiredPeer dependency required for runtime helpers.
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources
what-compiler — npm install what-compiler · libregistry