Using babel-standalone in the browser

Jamgreen picture Jamgreen · Oct 11, 2016 · Viewed 11.4k times · Source

I am using babel-standalone and I am doing the exact same thing as https://github.com/Daniel15/babel-standalone/blob/master/examples/scriptTag-src.htm, but I get the warning

You are using the in-browser Babel transformer. Be sure to precompile your scripts for production - https://babeljs.io/docs/setup/

I don't know what to do. Shouldn't it just translate all my ES6 code to code supported by older browsers?

Answer

Frxstrem picture Frxstrem · Oct 11, 2016

It's just a warning, nothing to worry about.

It's just telling you that you shouldn't run Babel in the browser on production sites, because running Babel in the browser is slower than precompiling your files with Babel, because the browser will have to compile your files every time you open a page. But if you're running it for development or personal pages, or if you just don't care (e.g., you don't have that much code), you won't need to worry about this warning.