如何在 tomcat 上运行 React 应用程序 [英] How to run a react app on tomcat

查看:51
本文介绍了如何在 tomcat 上运行 React 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行以下示例:https://github.com/ceolter/ag-grid-react-example

I'm trying to run the following example: https://github.com/ceolter/ag-grid-react-example

(ag-grid 反应示例)

(ag-grid react example)

但是,我想在 tomcat 上运行它,而不是执行 npm run.怎么做?

But, instead of doing npm run I want to run it on tomcat. How to do it?

推荐答案

您可以轻松地在 Tomcat 上部署任何静态文件.您链接的项目没有用于构建示例生产版本的脚本,因此您需要做的是:

You can easily deploy any static files on Tomcat. The project you linked does not have a script to build production version of the sample, so what you need to do is:

  1. 在本地安装 webpack:npm install -g webpack
  2. 构建演示:webpack --config webpack.config.standard.js --progress --colors --hot --inlinewebpack --config webpack.config.large.js --progress --colors --hot --inline.它将创建 dist 目录.
  3. 在 Tomcat webapps 目录中为您的演示 ag-grid 创建另一个目录.
  4. index.htmldist 复制到 ag-grid.
  5. http://host:port/ag-grid 上访问它.
  1. Install webpack locally: npm install -g webpack
  2. Build demo: webpack --config webpack.config.standard.js --progress --colors --hot --inline or webpack --config webpack.config.large.js --progress --colors --hot --inline. It will create dist directory.
  3. In Tomcat webapps directory create create another directory for your demo ag-grid.
  4. Copy index.html and dist to ag-grid.
  5. Access it on http://host:port/ag-grid.

这篇关于如何在 tomcat 上运行 React 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆