composer require swisscom/reactintegration
create-react-app Flow Integration
create-react-app (CRA) is specifically optimized for single-page apps; but through some workarounds it can be used for developing JS for multi-page apps as well. This package bundles these workarounds.
The main problem of CRA is that there is no default way of running the dev-server watch-mode, and have it emit static JS files which we can simply include. This might be solved as soon as this PR is merged in CRA.
Furthermore, CRA employs code splitting; so during development the URLs of the dev server change very often.
This package provides a
Swisscom.ReactIntegration:ReactScripts Fusion prototype, which renders the necessary
script tags. In development mode, it extracts the script tag URLs from the CRA dev-server (by CURL'ing to http://localhost:3000);
and in production mode it simply emits the built files.
If the setting
Swisscom.ReactIntegration.productionMode is true (default in
Production context), we load
the built JS. Otherwise, we load the scripts from the CRA dev server URL.
Install this package as usual.
kickstart your react app in
Add a symlink from
Add the following Fusion to your Page: