我正在遵循我认为是学习React的过时课程。在第一个教程中,html文件的内容如下:
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.2.0/cjs/react.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.2.0/cjs/react-dom-server.browser.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>
</body>
<script type="text/babel">
// Define a react component class
var HelloWorld = React.createClass({});
// Ask react to render this class
var element = React.createElement(HelloWorld);
// Place the rendered element in the DOM
ReactDOM.render(element, document.body);
</script>
当尝试在浏览器中查看html文件时,我收到3个错误:
Uncaught ReferenceError: process is not defined
at react.development.js:14
Uncaught ReferenceError: process is not defined
at react-dom-server.browser.development.js:14
Uncaught ReferenceError: React is not defined
at <anonymous>:3:13
我一直在搜索Google和Stackoverflow,所有提到的Babel和React都是指Webpack设置或Rollup等。以这种方式编写的简单页面是否可以在没有构建过程的情况下工作?我不知道出了什么问题。