# webpack-organic-webcell-configurator

> configure webpack.config.js to build organic frontend web cells

Latest version **1.4.0** (published 2019-09-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-organic-webcell-configurator
pnpm add webpack-organic-webcell-configurator
yarn add webpack-organic-webcell-configurator
bun add webpack-organic-webcell-configurator
```

## 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.4.0 |
| Published | 2019-09-10 |
| First published | 2018-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Boris Filipov |
| Maintainers | outbounder |

## Links

- npm: https://www.npmjs.com/package/webpack-organic-webcell-configurator
- Repository: https://github.com/node-organic/webpack-organic-webcell-configurator
- Homepage: https://github.com/node-organic/webpack-organic-webcell-configurator#readme
- Issues: https://github.com/node-organic/webpack-organic-webcell-configurator/issues
- npm.io page: https://npm.io/package/webpack-organic-webcell-configurator

## Dependencies (4)

- [resolve](https://npm.io/package/resolve.md) ^1.7.1
- [organic-dna-loader](https://npm.io/package/organic-dna-loader.md) ^1.8.0
- [organic-dna-branches](https://npm.io/package/organic-dna-branches.md) 0.0.2
- [webpack-inject-plugin](https://npm.io/package/webpack-inject-plugin.md) ^1.5.3

## Recent versions

- 1.4.0 (latest) — 2019-09-10
- 1.3.0 — 2019-05-14
- 1.2.0 — 2018-05-27
- 1.1.0 — 2018-04-19
- 1.0.0 — 2018-04-15

## README

# webpack-organic-webcell-configurator

configure webpack.config.js to build organic frontend web cells

* Bundles DNA configuration loaded by organic-dna-loader
* then transforms a build branch so that organelles can be resolved required/bundled
* finally export the selected DNA and bundle it along with webpack

## API

### webcell(options, webpackConfig)

#### options

* `dnaSourcePaths` - Array, holds full paths to dna source directories to load
* `selectBranch` - String, dot notated branch path to select for inclusion into the bundle. Leave undefined to use the whole dna.
* `transformBranch` - Function, optional. Used to transform async selected branch. Has signature `async function transformBranch (selectedBranch)` resolving to a DNA branch to be bundled.
* `buildBranch` - String, branch name within selected dna to transform any organelle `source` property paths as `require`s
* `exportName` - String, defaults to `window.DNA` value which will be used to globally 
provide the bundled DNA
* `dnaMode` - String, indicates the mode which will be applied on the loaded DNA. 
Defaults to `process.env.CELL_MODE`

#### webpackConfig

* as `Object` - the usually exported webpack.config.js configuration object
* as `function webpackConfig (dna):<Promise>` - decorator function receives the whole loaded DNA
and returns webpack.config.js configuration object or a promise for it.

## usage

```
// webpack.config.js
const path = require('path')
const webcell = require('webpack-organic-webcell-configurator')
const BUILD_MODE = process.env.NODE_ENV === 'production' ? 'production' : 'development'

module.exports = webcell({
  dnaSourcePaths: [
    path.join(__dirname, 'dna')
  ],
  buildBranch: 'build',
  selectBranch: 'cells.frontend-cell',
  exportName: 'window.DNA',
  dnaMode: BUILD_MODE
}, {
  mode: BUILD_MODE,
  entry: './main.js'
})
```

### webpackConfig argument as function

```
module.exports = webcell(options, function (dna) { 
  return webpackConfig 
})
```

### webpackConfig argument as Promise/async function

```
module.exports = webcell(options, async function (dna) { 
  // ... await async operations
  return webpackConfig 
})
```

---
_Source: https://npm.io/package/webpack-organic-webcell-configurator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
