Astronought
Astronought

Reputation: 435

Standalone Babel and using arrow functions plugin?

I'm building an App in a non-node environment but I want to make use of Babel's ES6 transpiling so that I can write somewhat nicer code and still support IE11.

So I went ahead and included the standalone file found here: https://github.com/babel/babel/tree/master/packages/babel-standalone

But it seems like you also need an additional plugin to actually transpile arrow function syntax, but of course because I don't have access to the import/export module features I'm not sure if it is even possible to include these plugins.

Does anyone know a way around this?

Upvotes: 0

Views: 631

Answers (1)

Jaromanda X
Jaromanda X

Reputation: 1

As you have shown ZERO code in the question, and you're going on about setting this preset or that preset (blah blah blah), I can only assume you're doing something wrong

This HTML works in IE

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Home</title>
    <script src="https://unpkg.com/@babel/polyfill/browser.js"></script>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
</head>
<body>
    <div id="output"></div>
    <script type="text/babel">
      const getMessage = () => "Hello World";
      document.getElementById('output').innerHTML = getMessage();
    </script>
</body>
</html>

How does it compare with what you are doing?

Upvotes: 2

Related Questions