🐠 Babel is a compiler for writing next generation JavaScript.
Switch branches/tags
Clone or download
Pull request Compare This branch is 1 commit ahead, 386 commits behind babel:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.github
codemods
doc
lib
packages
scripts
test
.editorconfig
.eslintignore
.eslintrc.json
.flowconfig
.gitattributes
.gitignore
.prettierignore
.prettierrc
.travis.yml
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Gulpfile.js
LICENSE
Makefile
README.md
SONG.md
babel.config.js
babel.sublime-project
codecov.yml
compile.sh
lerna.json
package.json
yarn.lock

README.md

Small JSX compiler

This repo is my attempt at creating a reasonably small JSX compiler.

The upstream version of babel-standalone's "minified" build clocks in at

curl https://unpkg.com/@babel/standalone@7.0.0-beta.51/babel.min.js | wc -c
# 1965073 bytes

nearly 2MB, and also does some DOM walking to process <script> tags.

I don't want any of that, I just want a pure function that converts a string of javascript with JSX to a string of javascript with React.createElement calls. (For use in the Sketch.systems playground; see forum thread for context.)

So, I removed all the babel plugins except @babel/plugin-transform-react-jsx and got rid of the DOM walking bits.

Run compile.sh to build /packages/babel-standalone/babel.min.js. Best I've gotten it down to is 969kB.

Please open an issue or pull request if this can be improved. (Or point me to another project that already does this!)

Thanks

--Kevin