简体   繁体   English

如何在codepen中运行使用“create-react-app”创建的react项目?

[英]how to run react project created with "create-react-app" in codepen?

I've created very basic react project with create-react-app command and wish to run in codepen我已经使用create-react-app命令创建了非常基本的反应项目,并希望在codepen运行

I did below settings under JS我在 JS 下做了以下设置

在此处输入图片说明

To run project locally I use command npm run , how to achieve that in codepen ?要在本地运行项目,我使用命令npm run ,如何在 codepen 中实现?

create-react-app compiles all the code into one or many javascript files. create-react-app将所有代码编译成一个或多个 javascript 文件。 You cannot do that in codepen.你不能在 codepen 中做到这一点。 You can use codepen with pre-compiled react files but you won't get what you would expect from create-react-app .您可以将 codepen 与预编译的 React 文件一起使用,但您不会从create-react-app获得您期望的内容。

See this Hello World example: https://reactjs.org/redirect-to-codepen/hello-world请参阅此 Hello World 示例: https : //reactjs.org/redirect-to-codepen/hello-world

There are other sites like glitch.me , codesandbox.io where you can clone the repo of create-react-app and use the node environment.还有其他站点,如glitch.mecodesandbox.io ,您可以在其中克隆create-react-app的 repo 并使用节点环境。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何运行Salesforce中create-react-app创建的React App - How to run React App created by create-react-app in Salesforce 如何指定一个端口来运行基于 create-react-app 的项目? - How to specify a port to run a create-react-app based project? 如何构建一个 create-react-app 项目 - how to structure a create-react-app project 如何将Redux添加到使用Create-React-App创建的React项目中? - How should I add Redux to a React project created with Create-React-App? 如何为使用 create-react-app 创建的 react 项目更新 webpack 配置? - How to update webpack config for a react project created using create-react-app? 如何将 Next.js 应用于使用 create-react-app 创建的 React 项目? - How can I apply Next.js to a React project created with create-react-app? 如何编写在项目创建的 create-react-app 的单页反应路由器上工作的 JS - How to write JS which working on single page of react router at project created create-react-app 如何在create-react-app创建的应用程序中使用jsx文件(不运行“npm run eject”)? - How to use jsx files in an app created by create-react-app (without run “npm run eject”)? 如何使用特定版本的create-react-app创建react项目? - How to create a react project with specific version of create-react-app? 如何将使用 create-react-app 构建的 React 项目升级到下一个 create-react-app 版本? - How to upgrade a React project built with create-react-app to the next create-react-app version?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM