2

使用 IntelliJ Idea 并创建 index.htm 文件

我只是想包含以下链接并在服务器端运行代码
屏幕上没有呈现任何内容:

<html >
<head>
    <script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>

    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>

    <title>Live Link</title>
</head>
<body>

    <div id="Output"></div>

    <script type="text/babel">
        ReactDOM.render(<h1>Hello Human</h1>, window.document.getElementById('Output'));
    </script>
</body>
</html>

此旧版本链接有效,但新版本链接无效。

https://stackoverflow.com/a/33963992/5078763

在 Console.log 中出现以下错误:

    babel.min.js:5 Uncaught SyntaxError: Invalid regular expression: Range out of order in character class
    at new RegExp (<anonymous>)
    at Object.<anonymous> (babel.min.js:5)
    at t (babel.min.js:1)
    at Object.t.__esModule (babel.min.js:19)
    at t (babel.min.js:1)
    at Object.<anonymous> (babel.min.js:2)
    at t (babel.min.js:1)
    at Object.e.exports (babel.min.js:1)
    at t (babel.min.js:1)
    at Object.e.exports.version (babel.min.js:1)
(anonymous) @ babel.min.js:5
t @ babel.min.js:1
t.__esModule @ babel.min.js:19
t @ babel.min.js:1
(anonymous) @ babel.min.js:2
t @ babel.min.js:1
e.exports @ babel.min.js:1
t @ babel.min.js:1
e.exports.version @ babel.min.js:1
t @ babel.min.js:1
t.__esModule @ babel.min.js:16
t @ babel.min.js:1
t.__esModule @ babel.min.js:11
t @ babel.min.js:1
(anonymous) @ babel.min.js:2
t.__esModule @ babel.min.js:2
t @ babel.min.js:1
t.__esModule @ babel.min.js:10
t @ babel.min.js:1
t.__esModule @ babel.min.js:14
t @ babel.min.js:1
t.__esModule @ babel.min.js:1
t @ babel.min.js:1
(anonymous) @ babel.min.js:1
(anonymous) @ babel.min.js:1
(anonymous) @ babel.min.js:1
(anonymous) @ babel.min.js:1
raven.min.js:2 <img>​
4

1 回答 1

4

缩小的babel.min.js包含 utf-8 编码的字符串。您可以通过<meta charset="utf-8">在您的<head>.

于 2017-11-02T23:57:05.550 回答