packages/react-server-cli/src/compileClient.js
function writeClientBootstrapFile(outputDir, opts) {
	const outputFile = outputDir + "/entry.js";
	fs.writeFileSync(outputFile, `
		import reactServer from "react-server";
	    import routes from "./routes_client";
	    
		if (typeof window !== "undefined") {
			window.__setReactServerBase = (path) => {
				__webpack_public_path__ = path;
				window.__reactServerBase = path;
			}
		}
		window.rfBootstrap = () => {
			reactServer.logging.setLevel('main',  ${JSON.stringify(opts.logLevel)});
			reactServer.logging.setLevel('time',  ${JSON.stringify(opts.timingLogLevel)});
			reactServer.logging.setLevel('gauge', ${JSON.stringify(opts.gaugeLogLevel)});
			new reactServer.ClientController({routes}).init();
		}`
	);
	return outputFile;
}
function writeClientBootstrapFile(outputDir, opts) {
	const outputFile = outputDir + "/entry.js";
	fs.writeFileSync(outputFile, `
		import reactServer from "react-server";
	    import routes from "./routes_client";
	    
		if (typeof window !== "undefined") {
			window.__setReactServerBase = (path) => {
				__webpack_public_path__ = path;
				window.__reactServerBase = path;
			}
		}
		window.rfBootstrap = () => {
			reactServer.logging.setLevel('main',  ${JSON.stringify(opts.logLevel)});
			reactServer.logging.setLevel('time',  ${JSON.stringify(opts.timingLogLevel)});
			reactServer.logging.setLevel('gauge', ${JSON.stringify(opts.gaugeLogLevel)});
			new reactServer.ClientController({routes}).init();
		}`
	);
	return outputFile;
}
writes out a bootstrap file for the client which in turn includes the client routes file. note that outputDir must be the same directory as the client routes file, which must be named "routes_client".