Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sahilrajput03/server-rendering-babel
https://github.com/sahilrajput03/server-rendering-babel
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/sahilrajput03/server-rendering-babel
- Owner: sahilrajput03
- Created: 2021-12-12T21:29:41.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-12T22:38:45.000Z (about 3 years ago)
- Last Synced: 2024-11-09T17:57:05.356Z (2 months ago)
- Language: JavaScript
- Size: 42 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Readme
Source: https://stackoverflow.com/a/43111885/10012446
Run below command:
```
npx babel a.js -d target/
node target/a.js
```## Other resources:
- https://reactjs.org/docs/react-dom-server.html
**Developing for rendering react component on the server:**
From `package.json` file:
```json
"babel:watch": "babel -w -d target",
"test": "nodemon express/test",
"server": "nodemon express/app"
```So via command
- `npm run babel:watch C2.js`: We can watch over file `C2.js` and all the jsx in it will be compilerd to javascript.
- `npm run test`: With this command I intend to test out compilerd javascript by simply importing that file in differen file.
- `npm run server`: With this commadn I intend to run express server and return the compiled javascript using some data fetched from database.