问题
I want to create React applications with JSX and not have to use a terminal or any server-side/dev environment commands. The environment we are using doesn't allow for commands to be run in the dev environment and these applications will be purely statically hosted on a CDN.
So I know I can simply include Babel's browser.js to do the JSX transpiling in the browser. Perfect. My concern is that Babel apparently stopped supporting this and modern versions of Babel have it removed. Is there another solution? Is babel-standalone what I should be using?
I fully understand the performance penalties in using this in production, but our use case (which I can't imagine is that unusual of a use case with so many great and simple online HTML/JS IDEs) allows for this.
回答1:
Yes if you don't want to bundle your own files, babel-standalone is what you should use.
See prototyping on the official documentation:
I'm using the CDN from the links above in a "codepen like" demo-project, and it works fine.
来源:https://stackoverflow.com/questions/38577282/client-side-jsx-transpiling