# webpack-config-spaceship

> Webpack config to get a project off the ground fast.

Latest version **0.8.1** (published 2017-03-14) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.1 |
| Published | 2017-03-14 |
| First published | 2017-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.5 |
| Dependencies | 29 |
| Known vulnerabilities | 0 (+15 in 4 direct dependencies) |
| Install scripts | no |
| Author | Marius Craciunoiu |
| Maintainers | mariusc23 |
| Keywords | webpack, spaceship |

## Links

- npm: https://www.npmjs.com/package/webpack-config-spaceship
- Repository: https://github.com/mariusc23/webpack-config-spaceship
- Homepage: https://github.com/mariusc23/webpack-config-spaceship#readme
- Issues: https://github.com/mariusc23/webpack-config-spaceship/issues
- npm.io page: https://npm.io/package/webpack-config-spaceship

## Dependencies (29)

- [find-up](https://npm.io/package/find-up.md) ^2.1.0
- [postcss](https://npm.io/package/postcss.md) ^5.2.15
- [webpack](https://npm.io/package/webpack.md) ^2.2.1
- [node-sass](https://npm.io/package/node-sass.md) ^4.5.0
- [babel-core](https://npm.io/package/babel-core.md) ^6.23.1
- [css-loader](https://npm.io/package/css-loader.md) ^0.26.2
- [url-loader](https://npm.io/package/url-loader.md) ^0.5.8
- [file-loader](https://npm.io/package/file-loader.md) ^0.10.1
- [html-loader](https://npm.io/package/html-loader.md) ^0.4.5
- [json-loader](https://npm.io/package/json-loader.md) ^0.5.4
- [path-exists](https://npm.io/package/path-exists.md) ^3.0.0
- [sass-loader](https://npm.io/package/sass-loader.md) ^6.0.2
- [autoprefixer](https://npm.io/package/autoprefixer.md) ^6.7.6
- [babel-loader](https://npm.io/package/babel-loader.md) ^6.4.0
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.0
- [style-loader](https://npm.io/package/style-loader.md) ^0.13.2
- [whatwg-fetch](https://npm.io/package/whatwg-fetch.md) ^2.0.3
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) ^6.23.0
- [lodash.groupby](https://npm.io/package/lodash.groupby.md) ^4.6.0
- [postcss-loader](https://npm.io/package/postcss-loader.md) ^1.3.3
- [lodash.mapvalues](https://npm.io/package/lodash.mapvalues.md) ^4.6.0
- [react-hot-loader](https://npm.io/package/react-hot-loader.md) ^3.0.0-beta.6
- [find-babel-config](https://npm.io/package/find-babel-config.md) ^1.0.1
- [webpack-dev-server](https://npm.io/package/webpack-dev-server.md) ^2.4.1
- [sass-variable-loader](https://npm.io/package/sass-variable-loader.md) ^0.1.1
- [babel-preset-spaceship](https://npm.io/package/babel-preset-spaceship.md) ^0.8.1
- [webpack-dev-middleware](https://npm.io/package/webpack-dev-middleware.md) ^1.10.1
- [webpack-hot-middleware](https://npm.io/package/webpack-hot-middleware.md) ^2.17.1
- [extract-text-webpack-plugin](https://npm.io/package/extract-text-webpack-plugin.md) ^2.1.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.8.1 (latest) — 2017-03-14
- 0.8.0 — 2017-03-14
- 0.7.2 — 2017-03-14
- 0.7.1 — 2017-03-14
- 0.7.0 — 2017-03-11
- 0.6.0 — 2017-03-10
- 0.5.0 — 2017-03-09
- 0.4.0 — 2017-03-09
- 0.3.1 — 2017-03-09
- 0.3.0 — 2017-03-09
- 0.2.0 — 2017-03-09
- 0.1.0 — 2017-03-09

## README

# webpack-config-spaceship

> Webpack config to get a project off the ground fast.

## Installation

    npm install --save-dev webpack-config-spaceship

## Setup

```js
// webpack.config.js
const spaceship = require('webpack-config-spaceship');

module.exports = spaceship({
  cwd: __dirname, // recommended
  entry: {
    main: './src/main/client/index.js',
  },
  output: {
    path: './dist',
    publicPath: '/assets',
  },
});
```

## Options

#### cwd

Path to project root.

```js
{
  cwd: __dirname, // recommended
}
```

#### context

**Relative** path to source directory. Affects entry paths. Relative to `options.cwd`.

#### entry

Webpack entry.

```js
{
  main: './main/client/index.jsx'
}
```

https://webpack.js.org/configuration/entry-context/#entry

#### output.path

**Relative** path to output directory.

```js
{
  output: {
    path: './build', // default
  },
}
```

#### output.publicPath

https://webpack.js.org/guides/public-path

#### merge

Webpack config to be `lodash.merge`d with the config generated by spaceship.

```js
const config = spaceship({
  merge: {
    devServer: {
      hot: true,
    },
    // etc
  },
});
```

#### vendor

Boolean whether to automatically create a vendor chunk with `babel-polyfill` and `whatwg-fetch`. Turn this off for libraries.

#### common

Boolean whether to automatically create a common chunk. Turn this off for libraries.

#### filterPlugin(plugin, i)

A function to filter out plugins generated by spaceship.

```js
const config = spaceship({
  filterPlugin(plugin, i) {
    if (Math.random() > 0.5) {
      return false;
    }
    return true;
  },
});
```

#### mapPlugin(plugin, i)

A function to replace some plugins with different ones.

```js
const config = spaceship({
  mapRule(rule, i) {
    if (i === 0) {
      return new webpack.optimize.OccurrenceOrderPlugin();
    }
    return rule;
  },
});
```

#### filterRule(rule, i)

Same as `filterPlugin`, but for rules.

#### mapRule(rule, i)

Same as `mapPlugin`, but for rules.

#### statsPath

Path to save webpack stats.

```js
{
  statsPath: 'src/webpack.stats.json', // default
}
```

#### manifestPath

Path to save manifest file (list of files by entry and type).

```js
{
  manifestPath: 'src/webpack.manifest.json', // default
}
```

#### stylesheets

Disable ExtractTextPlugin.

## Hot Module Reloading

Spaceship automatically configures:

- `HotModuleReplacementPlugin`
- `NamedModulesPlugin`
- `react-hot-loader/babel`
- `devServer` config option

What you'll need to configure:

- entry loaders
  - `react-hot-loader/patch`
  - `webpack-dev-server/client?http://localhost:8080`,
  - `webpack/hot/only-dev-server`
- `<AppContainer />`

https://webpack.js.org/guides/hmr-react/

## License

Copyright (c) 2017 Marius Craciunoiu. Licensed under the MIT license.

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