import-essex
v0.3.0
Published
Import JSX as essex components in NodeJS
Maintainers
Readme
import-essex
Import and transpile JSX via loader hooks for use with the Essex template runtime. It doesn't transpile anything besides JSX and caches transpiled sources by default.
This library has been forked from vadimdemedes/import-jsx.
Install
npm install import-essexUsage
Note:
import-essexonly works with ES modules.
node --loader=import-essex example.jsexample.js
const HelloWorld = () => <h1>Hello world</h1>;Alternatively, the following can be placed in the entry file for your Node application.
import { register } from 'node:module';
register(import.meta.resolve('import-essex'));Disable cache
import-essex caches transpiled sources by default, so that the same file is transpiled only once.
If that's not a desired behavior, turn off caching by setting IMPORT_ESSEX_CACHE=0 or IMPORT_ESSEX_CACHE=false environment variable.
IMPORT_ESSEX_CACHE=0 node --loader=import-essex my-code.js