@rebox/web
Set of helpers to deal with React applications using our Babel config.
Install
$ yarn add @rebox/web
API
type TBuildWebAppReleaseOptions = {
entryPointPath: string,
htmlTemplatePath: string,
outputPath: string,
browsersList?: string[],
globalConstants?: {
[key: string]: string
},
globalAliases?: {
[key: string]: string
},
isQuiet?: boolean,
shouldGenerateSourceMaps?: boolean,
shouldGenerateBundleAnalyzerReport?: boolean
}
const buildWebAppRelease: (userOptions: TBuildWebAppReleaseOptions) => Promise<void>
type TRunWebAppOptions = {
entryPointPath: string,
htmlTemplatePath: string,
browsersList?: string[],
assetsPath?: string,
isQuiet?: boolean,
shouldOpenBrowser?: boolean
}
const runWebApp: (options: TRunWebAppOptions) => Promise<() => Promise<void>>
Usage
import React, { FC } from 'react'
export const App: FC<{}> = () => (
<h1>Test</h1>
)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Test</title>
<style>
body { margin: 0 }
</style>
</head>
<body>
<div id="root"></div>
</body>
</html>
import { buildWebAppRelease } from '@rebox/web'
await buildWebAppRelease({
entryPointPath: './App.tsx',
htmlTemplatePath: './template.html',
outputPath: './build/',
})
import { runWebApp } from '@rebox/web'
await runWebApp({
entryPointPath: './App.tsx',
htmlTemplatePath: './template.html'
})