Skip to content

lynaghk/babel

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 1 commit ahead, 2094 commits behind babel:master.

Latest commit

 

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
doc
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

🐠 Babel is a compiler for writing next generation JavaScript.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.8%
  • Other 0.2%