简体   繁体   English

如何将小型 gatsby 应用程序嵌入到 CRA 应用程序中

[英]How can I embed small gatsby app into a CRA App

I have 2 applications - one written with CRA and one written with Gatsby.我有 2 个应用程序 - 一个用 CRA 编写,一个用 Gatsby 编写。 I would like to import the gatsby application into the CRA application.我想将 gatsby 应用程序导入 CRA 应用程序。 I managed to do it with an iframe, but it is not a solution that satisfies me.我设法用 iframe 做到了,但这不是一个让我满意的解决方案。 Is it possible to load a Gatsby application using the script tag?是否可以使用脚本标签加载 Gatsby 应用程序? I think it might be difficult because I can see that after building a gatsby application, there are a lot of files in the public directory, and from what I know, it is impossible to create one output file.我认为这可能很难,因为我可以看到构建一个 gatsby 应用程序后,公共目录中有很多文件,据我所知,不可能创建一个 output 文件。

I would like to import it like this我想像这样导入它

<script src="path/to/gatsby" />

Do you think it is possible at all?你认为有可能吗? Has anyone had a similar problem?有没有人遇到过类似的问题?

Gatsby does not compile to a module, alas, it builds a collection of fully static HTML pages that rehydrate client-side along with initializing the client-side portion of Gatsby (routing, eager page loading, fetching data for new pages for client-side navigation, etc). Gatsby 不会编译为模块,唉,它构建了一个完整的 static HTML 页面的集合,这些页面在初始化 Gatsby 的客户端部分(路由,急切页面加载,为客户端的新页面获取数据导航等)。

You'd be better off porting your Gatsby components and pages into your CRA app or vice versa.您最好将 Gatsby 组件和页面移植到您的 CRA 应用程序中,反之亦然。

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

相关问题 如何将 Angular 5 应用程序嵌入到另一个页面的 HTML 中? - How can I embed a Angular 5 app into HTML in another page? 我如何将Outlook Web App嵌入我的网站? - How i can embed Outlook Web App into my site? 如何在Shiny应用程序中嵌入Twitter时间线 - How can I embed a twitter timeline in a Shiny app 如何在CRA(create-react-app)中对资产进行版本控制? - How to do versioning for assets in a CRA (create-react-app)? 如何在没有 create-react-app 的情况下像在 CRA 中一样配置代理? - How to configure a proxy like in CRA without create-react-app? 如何使用 CRA 为已构建的 react 应用程序实施 SSR? - How to implement SSR for an already built react app with CRA? 如何将新的 React JS 前端嵌入到我现有的单体 Node JS 应用程序中? - How can I embed new React JS Front-end in my existing monolithic Node JS App? 可以在Grails应用程序中嵌入GWT面板以呈现网址吗? - can I embed a GWT panel in a grails app to render a url? 我想显示一条消息,指出无法在此小型设备上查看此应用 - I want to display a message that this app can not be viewed in this small device 如何限制谁可以 iframe 嵌入我的网络应用程序? - How to restrict who can iframe embed my web app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM