# craco-change-build-directory

> Plugin to change build directory on create-react-app projects using CRACO

Latest version **1.0.0** (published 2021-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install craco-change-build-directory
pnpm add craco-change-build-directory
yarn add craco-change-build-directory
bun add craco-change-build-directory
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-10-28 |
| First published | 2021-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Eduardo P de Sousa |
| Maintainers | _edupsousa |
| Keywords | craco, cra, create-react-app, plugin |

## Links

- npm: https://www.npmjs.com/package/craco-change-build-directory
- Repository: https://github.com/edupsousa/craco-change-build-directory
- Homepage: https://github.com/edupsousa/craco-change-build-directory#readme
- Issues: https://github.com/edupsousa/craco-change-build-directory/issues
- npm.io page: https://npm.io/package/craco-change-build-directory

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-10-28

## README

# CRACO Change Build Directory Plugin

This plugin allows you to change the `build` directory path on your create-react-app project.

It replaces the following CRA and Webpack configuration settings with your new path:

- `paths.appBuild`
- `webpackConfig.output.path`

## Usage Example

Install CRACO following the instructions on their documentation: <https://www.npmjs.com/package/@craco/craco#installation>

Install the plugin using:

```bash
npm install -D craco-change-build-directory
```

Create a `craco.config.js` containing at the least the following:

```js
const path = require('path');
const changeBuildDirectory = require('craco-change-build-directory');

const newBuildPath = path.resolve('your-new-build-directory');

module.exports = {
  plugins: [
    {
      plugin: changeBuildDirectory,
      options: {
        newPath: newBuildPath,
      },
    },
  ],
};
```

## Limitations and Known Issues

The way this plugin works is kind of a hack. The purpose of the method `overrideWebpackConfig` is to return a modified webpack configuration, but we use the same method make changes to the `context.paths` object received as parameter.

Unfortunately, right now, there's no hook method on CRACO plugin system with the purpose of making changes to the `context` or `context.paths` object. This misuse of CRACO plugin API implies that small changes in the future can easily break this plugin functionality.

Also there's a chance that other (CRA/CRACO/Jest/WebPack/...) plugins read the path before our changes are made, or have this paths hardcoded.

---
_Source: https://npm.io/package/craco-change-build-directory · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
