# webpack-config-prefabs

Latest version **0.0.5** (published 2020-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-config-prefabs
pnpm add webpack-config-prefabs
yarn add webpack-config-prefabs
bun add webpack-config-prefabs
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2020-08-10 |
| First published | 2019-07-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 375 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Andrew Bradley |
| Maintainers | cspotcode |

## Links

- npm: https://www.npmjs.com/package/webpack-config-prefabs
- Repository: https://github.com/cspotcode/personal-monorepo
- Homepage: https://github.com/cspotcode/personal-monorepo/tree/master/packages/webpack-config-prefabs
- Issues: https://github.com/cspotcode/personal-monorepo/issues?labels=P:webpack-config-prefabs
- npm.io page: https://npm.io/package/webpack-config-prefabs

## Dependencies (10)

- [tslib](https://npm.io/package/tslib.md) ^2.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [find-up](https://npm.io/package/find-up.md) ^4.1.0
- [webpack](https://npm.io/package/webpack.md) *
- [ts-loader](https://npm.io/package/ts-loader.md) *
- [typescript](https://npm.io/package/typescript.md) *
- [webpack-cli](https://npm.io/package/webpack-cli.md) *
- [@types/webpack](https://npm.io/package/@types/webpack.md) ^4.4.34
- [source-map-loader](https://npm.io/package/source-map-loader.md) *
- [string-replace-loader](https://npm.io/package/string-replace-loader.md) *

## Recent versions

- 0.0.5 (latest) — 2020-08-10
- 0.0.4 — 2020-08-10
- 0.0.3 — 2020-04-12
- 0.0.2 — 2019-07-09
- 0.0.1 — 2019-07-08

## README

# webpack-config-prefabs

Using webpack shouldn't require fiddling with configuration flags for every project.  This
library exposes factory functions that create sensible, default webpack configurations
for different situations.

They have a few built-in options to tweak the configuration.  If
you have more advanced needs, you can modify the returned configuration.
It is, after all, just an object.

## Example

To bundle a node module or CLI tool, perhaps to reduce download size or increase startup speed,
write a `webpack.config.js` that looks like this:

```javascript
const {nodeLibrary} = require('webpack-config-prefabs');
module.exports = nodeLibrary(module, {
    entry: './src/index.js',
    outputFilepath: './dist/index.js',
});
```

*`module` is passed so that we can discover the root directory of your project, which
allows us to generate more defaults automatically.*

## Experimental automatic configuration

If you want to avoid creating a `webpack.config.js`, add a package script that
tells webpack to use the bundled auto.js script.  Also add a
`"webpack-config-prefabs"` property specifying which prefab to use.

```
// in your package.json
"scripts": {
    "bundle": "webpack --config ./node_modules/webpack-config-prefabs/auto.js"
},
"webpack-config-prefabs": "nodeLibrary"
```

And run the script:

```
$ yarn bundle
```

`auto.js` will read your package.json and generate a default config from the
prefab.  You can't specify options, so you're forced to use the default.

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