All Projects → Nargonath → Cra Build Watch

Nargonath / Cra Build Watch

Licence: mit
A script for create-react-app that writes development builds to the disk

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Cra Build Watch

Webpack Serve
Takes your webpack config and creates a development server with hot module reloading and error overlay
Stars: ✭ 177 (+60.91%)
Mutual labels:  webpack, create-react-app, development
Mhy
🧩 A zero-config, out-of-the-box, multi-purpose toolbox and development environment
Stars: ✭ 128 (+16.36%)
Mutual labels:  webpack, build, development-environment
Docker Rails React Starter
A basic docker-compose, Rails and React / Webpack starter kit
Stars: ✭ 52 (-52.73%)
Mutual labels:  webpack, create-react-app
Craco Alias
A craco plugin for automatic aliases generation for Webpack and Jest
Stars: ✭ 56 (-49.09%)
Mutual labels:  webpack, create-react-app
Starter React Flux
Generate your React PWA project with TypeScript or JavaScript
Stars: ✭ 65 (-40.91%)
Mutual labels:  webpack, create-react-app
Npm Build Boilerplate
A collection of packages that build a website using npm scripts.
Stars: ✭ 963 (+775.45%)
Mutual labels:  build, watch
Webpack Isomorphic Dev Middleware
The webpack-dev-middleware, but for isomorphic applications
Stars: ✭ 38 (-65.45%)
Mutual labels:  webpack, development
Webpack Serve
Repository has moved:
Stars: ✭ 1,125 (+922.73%)
Mutual labels:  webpack, development
Ram
⚛️ React Application Manager: create and run React (and other) applications – no command line or build setup required
Stars: ✭ 585 (+431.82%)
Mutual labels:  create-react-app, development
Pric
Simple zero-config tool to create Private Certificate Authority & issue locally-trusted development server certificates with any domain names you'd like. SSL certificates for development purposes.
Stars: ✭ 87 (-20.91%)
Mutual labels:  development-environment, development
Auxpack
A dashboard for monitoring Webpack build stats.
Stars: ✭ 86 (-21.82%)
Mutual labels:  webpack, build
Wordless
All the power of Pug, Sass, Coffeescript and WebPack in your WordPress theme. Stop writing themes like it's 1998.
Stars: ✭ 1,374 (+1149.09%)
Mutual labels:  webpack, development
Angular Builders
Angular build facade extensions (Jest and custom webpack configuration)
Stars: ✭ 843 (+666.36%)
Mutual labels:  webpack, build
Error Overlay Webpack Plugin
Catch errors with style 💥✨
Stars: ✭ 821 (+646.36%)
Mutual labels:  webpack, create-react-app
React Antd Admin Template
一个基于React+Antd的后台管理模版,在线预览https://nlrx-wjc.github.io/react-antd-admin-template/
Stars: ✭ 1,022 (+829.09%)
Mutual labels:  webpack, create-react-app
React App
Create React App with server-side code support
Stars: ✭ 614 (+458.18%)
Mutual labels:  webpack, create-react-app
React App Rewired
Override create-react-app webpack configs without ejecting
Stars: ✭ 8,630 (+7745.45%)
Mutual labels:  webpack, create-react-app
Webpack Format Messages
Beautiful formatting for Webpack messages; ported from Create React App!
Stars: ✭ 103 (-6.36%)
Mutual labels:  webpack, create-react-app
Ts Monorepo
Template for setting up a TypeScript monorepo
Stars: ✭ 459 (+317.27%)
Mutual labels:  webpack, create-react-app
Backpack
🎒 Backpack is a minimalistic build system for Node.js projects.
Stars: ✭ 4,466 (+3960%)
Mutual labels:  webpack, build

cra-build-watch

A script for create-react-app that writes development builds to the disk

semantic-release code style: prettier Commitizen friendly Build Status npm version dependabot License: MIT

Disclaimer

The builds resulting from this script are NOT for production environment. They lack various optimizations.

This script is meant as a temporary workaround for create-react-app project based until this feature is built-in into react-scripts. See create-react-app#1070.

This script is inspired by other work related such as: https://gist.github.com/jasonblanchard/ae0d2e304a647cd847c0b4493c2353d4.

Ejection

You do not need to eject your project for you to use cra-build-watch.

This tool handles ejected projects but it assumes you did not modify your webpack.config.js file, paths.js and env.js utils. If you did I cannot guarantee that this tool will work.

Why do I need this?

As of now (20/04/2018), create-react-app (more precisely react-scripts) does not allow development builds to be written to the disk because it uses webpackDevServer to serve your build files and folders (for good reasons). The problem is that in some cases you need to have these files written to the disk i.e:

  • Developing browser extensions using React.
  • Incorporating your React application into an existing application.
  • Serving your React app with a dedicated backend.

Prerequisites

Supports react-scripts >= 1.0.x, hence it supports the newest version 4.x.x.

Supports node >= 10.

Installation

Add it to your project using npm:

npm install -D cra-build-watch

or using yarn:

yarn add -D cra-build-watch

Usage

Add a new script into your package.json:

{
  "scripts": {
    "watch": "cra-build-watch"
  }
}

Run that script:

npm run watch

with Yarn:

yarn watch

Configuration

By default the script will generate everything into build/ at your project root and remove the public path from webpack's configuration.

If those defaults do not work for you, the script accepts some arguments:

  • --after-initial-build-hook: accepts a string of shell code that will be run only once after the initial build in the same process as the cra-build-watch.
  • --after-rebuild-hook: accepts a string of shell code that will be run every time webpack rebuilds your project after a filesystem change. It runs in the same process as cra-build-watch.
  • -b|--build-path: expects either an absolute or relative path. If a relative path is given it will be prefixed by your project root path.
    • default: yourProjectRoot/build.
  • --chunk-filename: Set the naming you want to use for non-entry chunk files. Accepts webpack placeholders such as [id], [name], [hash]. Directories can be supplied.
    • default: js/bundle.js.
  • --disable-chunks: disable code-splitting / chunks so that only a single bundle.js file is generated. It only works with react-scripts >= 2.0.0.
  • -o|--output-filename: Set the name to be used for the output bundle. Accepts webpack placeholders such as [id], [name], [hash]. Directories can be supplied.
    • default: js/[name].chunk.js
  • --react-scripts-version: expects the react-scripts version you are using in your project i.e 2.0.3. If not given it will be implied from your node_modules and if it cannot be implied the version 2.1.2 will be the default. Consider setting it if you ejected and are not using the latest react-scripts version.
  • -p|--public-path: expects a relative URL where / is the root. If you serve your files using an external webserver this argument is to match with your web server configuration. More information can be found in webpack configuration guide.
    • default: "".
  • -v|--verbose: display webpack build output.

Contributions

All contributions are welcomed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].