# vuex-cli-webpack

> vuex-cli 中的 webpack 任务。

Latest version **2.0.0-beta2** (published 2016-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install vuex-cli-webpack
pnpm add vuex-cli-webpack
yarn add vuex-cli-webpack
bun add vuex-cli-webpack
```

Provides the commands `vuex-webpack-server`, `vuex-webpack-compile`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.0-beta2 |
| Published | 2016-11-15 |
| First published | 2016-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.2.0 |
| Dependencies | 55 |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | sokis |
| Maintainers | sokis |
| Keywords | vue, vuex, webpack, vuex-cli, vuex-webpack |

## Links

- npm: https://www.npmjs.com/package/vuex-cli-webpack
- Repository: https://github.com/sokis/vuex-cli-webpack
- Homepage: https://github.com/sokis/vuex-cli-webpack#readme
- Issues: https://github.com/sokis/vuex-cli-webpack/issues
- npm.io page: https://npm.io/package/vuex-cli-webpack

## Dependencies (55)

- [ip](https://npm.io/package/ip.md) ^1.1.4
- [koa](https://npm.io/package/koa.md) ^2.0.0
- [chai](https://npm.io/package/chai.md) ^3.5.0
- [debug](https://npm.io/package/debug.md) ^2.3.2
- [eslint](https://npm.io/package/eslint.md) ^3.10.1
- [cssnano](https://npm.io/package/cssnano.md) ^3.8.0
- [history](https://npm.io/package/history.md) ^2.1.2
- [webpack](https://npm.io/package/webpack.md) ^1.13.3
- [fs-extra](https://npm.io/package/fs-extra.md) ^0.30.0
- [koa-send](https://npm.io/package/koa-send.md) ^3.2.0
- [koa-proxy](https://npm.io/package/koa-proxy.md) ^0.6.0
- [babel-core](https://npm.io/package/babel-core.md) ^6.18.2
- [css-loader](https://npm.io/package/css-loader.md) ^0.23.1
- [koa-logger](https://npm.io/package/koa-logger.md) ^2.0.0
- [koa-static](https://npm.io/package/koa-static.md) ^3.0.0
- [url-loader](https://npm.io/package/url-loader.md) ^0.5.7
- [babel-types](https://npm.io/package/babel-types.md) ^6.18.0
- [compression](https://npm.io/package/compression.md) ^1.6.2
- [file-loader](https://npm.io/package/file-loader.md) ^0.9.0
- [json-loader](https://npm.io/package/json-loader.md) ^0.5.4
- [postcss-url](https://npm.io/package/postcss-url.md) ^5.1.2
- [babel-eslint](https://npm.io/package/babel-eslint.md) ^7.1.0
- [babel-loader](https://npm.io/package/babel-loader.md) ^6.2.7
- [koa-compress](https://npm.io/package/koa-compress.md) ^1.0.9
- [style-loader](https://npm.io/package/style-loader.md) ^0.13.1
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.18.0
- [eslint-loader](https://npm.io/package/eslint-loader.md) ^1.6.1
- [normalize.css](https://npm.io/package/normalize.css.md) ^4.2.0
- [plato-request](https://npm.io/package/plato-request.md) ^0.1.0
- [webpack-merge](https://npm.io/package/webpack-merge.md) ^0.14.1
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) ^6.9.0
- [babel-register](https://npm.io/package/babel-register.md) ^6.18.0
- [imports-loader](https://npm.io/package/imports-loader.md) ^0.6.5
- [postcss-import](https://npm.io/package/postcss-import.md) ^8.2.0
- [postcss-loader](https://npm.io/package/postcss-loader.md) ^0.9.1
- [postcss-mixins](https://npm.io/package/postcss-mixins.md) ^5.4.0
- [postcss-cssnext](https://npm.io/package/postcss-cssnext.md) ^2.8.0
- [postcss-reporter](https://npm.io/package/postcss-reporter.md) ^1.4.1
- [eslint-config-vue](https://npm.io/package/eslint-config-vue.md) ^2.0.1
- [eslint-plugin-vue](https://npm.io/package/eslint-plugin-vue.md) ^1.0.0
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.18.0
- [eslint-plugin-babel](https://npm.io/package/eslint-plugin-babel.md) ^3.3.0
- [html-webpack-plugin](https://npm.io/package/html-webpack-plugin.md) ^2.24.1
- [babel-preset-stage-0](https://npm.io/package/babel-preset-stage-0.md) ^6.16.0
- [postcss-font-variant](https://npm.io/package/postcss-font-variant.md) ^2.0.1
- [eslint-plugin-promise](https://npm.io/package/eslint-plugin-promise.md) ^3.3.2
- [webpack-dev-middleware](https://npm.io/package/webpack-dev-middleware.md) ^1.8.4
- [webpack-hot-middleware](https://npm.io/package/webpack-hot-middleware.md) ^2.13.2
- [postcss-browser-reporter](https://npm.io/package/postcss-browser-reporter.md) ^0.5.0
- [postcss-custom-properties](https://npm.io/package/postcss-custom-properties.md) ^5.0.1
- [extract-text-webpack-plugin](https://npm.io/package/extract-text-webpack-plugin.md) ^1.0.1
- [babel-plugin-transform-runtime](https://npm.io/package/babel-plugin-transform-runtime.md) ^6.15.0
- [babel-plugin-add-module-exports](https://npm.io/package/babel-plugin-add-module-exports.md) ^0.2.1
- [koa-connect-history-api-fallback](https://npm.io/package/koa-connect-history-api-fallback.md) ^0.3.1
- [babel-plugin-transform-async-to-generator](https://npm.io/package/babel-plugin-transform-async-to-generator.md) ^6.16.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

- 2.0.0-beta2 (latest) — 2016-11-15
- 2.0.0-beta.9 (next) — 2016-12-20
- 2.0.0-beta.8 — 2016-12-12
- 2.0.0-beta.7 — 2016-12-12
- 2.0.0-beta4 — 2016-11-15
- 2.0.0-beta3 — 2016-11-15
- 1.0.15 — 2016-08-30
- 1.0.13 — 2016-08-12
- 1.0.12 — 2016-08-04
- 1.0.11 — 2016-08-01
- 1.0.10 — 2016-08-01
- 1.0.9 — 2016-08-01
- 1.0.8 — 2016-08-01
- 1.0.7 — 2016-08-01
- 1.0.6 — 2016-08-01
- … 12 more at https://npm.io/package/vuex-cli-webpack/versions

## README

# vuex-cli-webpack
抽离webpack 构建相关任务。已经集成到`vuex-cli@2.0` .
也可以单独使用

## 使用方法

```javascript
import { server , compile} from 'vuex-cli-webpack'

//调用
server()
compile()
```

**命令行调用**
```
# 启动开发服务器
$ node ./node_modules/.bin/vuex-webpack-server


# 编译代码
$ node ./node_modules/.bin/vuex-webpack-compile

```

## 一些约束
默认的配置是按照目前流行的配置方案来做的，实际开发中多少会需要修改
这个时候，你只需要在项目根目录下创建`config`文件夹，并且在文件夹下添加对应的配置文件即可
```
config
├── development.conf.js      # 开发环境配置
├── production.conf.js		 # 生产环境配置
├── ... ...					 # 测试等
└── webpack.config.js		 # webpack配置
```

## development.conf.js

开发环境下的配置文件

```javascript
// ======================================================
// NODE_ENV === 'development'
// ======================================================

var config = require('vuex-cli-webpack/lib/config')

module.exports = {
	compiler_public_path: `http://${config.server_host}:${config.server_port}/`,
	proxy: {
		enabled: true,
		options: {
			host: 'http://cnodejs.org/',
			match: /^\/api\/.*/
		}
	}
}
```

## production.conf.js

生产环境下的配置文件

```javascript
// ======================================================
// NODE_ENV === 'production'
// ======================================================
module.exports = {
	compiler_public_path: '/',
	compiler_hash_type: 'chunkhash',
	compiler_devtool: null,
	compiler_stats: {
		chunks: true,
		chunkModules: true,
		colors: true
	}
}
```

### 一部分配置项说明

+ **compiler_public_path**：webpack.publicPath 用法相同
+ **proxy**：用于配置代理服务器
	- enabled: 是否启用代理
	- options: 具体可以参考`koa-proxy`
+ **compiler_hash_type**：设置文件名中hash命名类型


## webpack.config.js

默认提供了一套配置，当需要修改配置请在项目根路径下`config`目录中添加 `webpack.config.js`

```javascript
// ======================================================
// webpack.config.js
// ======================================================

var config = require('vuex-cli-webpack/lib/config')
var paths = config.utils_paths

module.exports  = {
	entry: {
		app: './src/main.js'
	},
	resolve: {
		alias: {
			"store": paths.client('vuex'),
			"components": paths.client('components')
		}
	}
}
```

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