0.1.0 • Published 4 years ago
require-tsx v0.1.0
require-tsx
direct require .tsx in Node.js
Usage
Installation:
yarn add require-tsx # Or npm install --save require-tsx// require in main file
require('require-tsx');Examples
Basic
- index.js
require('require-tsx');
require('./foo').test();- foo.tsx
export function test() {
return <div>Are you OK?</div>;
}Custom Inject
require('require-tsx').inject({
'.txt': (content, fileName) => content.replace('foo', 'bar'),
});more see source code
Motivation
I want render React components to DOM string by direct require.
You should think carefully before using this repo in production. No usability and compatibility tests.
License
MIT License.
0.1.0
4 years ago