是否有用于动态反应应用程序的一体化构建系统?

Is there an all-in-one build system for dynamic react applications?

构建像 next.js、razzle 和 back-pack 这样的系统似乎很有用,但根据我发现的示例和它们生成的默认应用程序,它们似乎适合服务器端渲染。是否有类似的构建系统可以(或此处提到的系统)用于构建带有 node.js 后端的动态 React 应用程序?

我希望找到一个我可以 运行 开箱即用的工具,它可以监视后端和前端代码并在对任何一个进行更改时刷新。我知道我可以找到一个 webpack 或 gulp 脚本来开始并自定义它,但我喜欢像上面这样的工具的想法,它只是一个命令。

编辑

我需要将我的前端部署到 Google Cloud Storage,所以我根本不需要任何服务器端渲染。

如果您不需要服务器端渲染,您可以选择 create-react-app

只要您仅使用导出支持的功能,您就可以导出 next.js 应用。

来自文档:

https://github.com/zeit/next.js/#static-html-export

This is a way to run your Next.js app as a standalone static app without any Node.js server. The export app supports almost every feature of Next.js including dynamic urls, prefetching, preloading and dynamic imports.

Simply develop your app as you normally do with Next.js. Then create a custom Next.js config as shown below:

// next.config.js
module.exports = {
  exportPathMap: function() {
    return {
      '/': { page: '/' },
      '/about': { page: '/about' },
      '/readme.md': { page: '/readme' },
      '/p/hello-nextjs': { page: '/post', query: { title: 'hello-nextjs' } },
      '/p/learn-nextjs': { page: '/post', query: { title: 'learn-nextjs' } },
      '/p/deploy-nextjs': { page: '/post', query: { title: 'deploy-nextjs' } }
    }
  }
}

In that, you specify what are the pages you need to export as static HTML.

Then simply run these commands: next build next export

关于限制:

Limitation With next export, we build HTML version of your app when you run the command next export. In that time, we'll run the getInitialProps functions of your pages.

So, you could only use pathname, query and asPath fields of the context object passed to getInitialProps. You can't use req or res fields.

Basically, you won't be able to render HTML content dynamically as we pre-build HTML files. If you need that, you need run your app with next start.