# atool-build

> Build tool based on webpack

Latest version **1.0.8** (published 2019-03-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install atool-build
pnpm add atool-build
yarn add atool-build
bun add atool-build
```

Provides the command `atool-build`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2019-03-05 |
| First published | 2015-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 31 |
| Unpacked size | 44.9 KB |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 387 |
| Author | chencheng |
| Maintainers | pigcan, yesmeck |

## Links

- npm: https://www.npmjs.com/package/atool-build
- Repository: https://github.com/ant-tool/atool-build
- Issues: https://github.com/ant-tool/atool-build/issues
- npm.io page: https://npm.io/package/atool-build

## Dependencies (31)

- [less](https://npm.io/package/less.md) ~2.7.2
- [chalk](https://npm.io/package/chalk.md) ^1.1.1
- [postcss](https://npm.io/package/postcss.md) ^5.2.17
- [webpack](https://npm.io/package/webpack.md) ~1.15.0
- [commander](https://npm.io/package/commander.md) ~2.9.0
- [ts-loader](https://npm.io/package/ts-loader.md) ^2.0.3
- [babel-core](https://npm.io/package/babel-core.md) ^6.24.1
- [css-loader](https://npm.io/package/css-loader.md) ~0.28.0
- [typescript](https://npm.io/package/typescript.md) ^2.2.2
- [umi-notify](https://npm.io/package/umi-notify.md) ^0.1.1
- [url-loader](https://npm.io/package/url-loader.md) ~0.5.8
- [file-loader](https://npm.io/package/file-loader.md) ~0.11.1
- [json-loader](https://npm.io/package/json-loader.md) ~0.5.4
- [less-loader](https://npm.io/package/less-loader.md) ~2.2.3
- [autoprefixer](https://npm.io/package/autoprefixer.md) ^6.7.7
- [babel-loader](https://npm.io/package/babel-loader.md) ^6.4.0
- [rucksack-css](https://npm.io/package/rucksack-css.md) ~0.9.1
- [node-notifier](https://npm.io/package/node-notifier.md) ^5.1.2
- [postcss-loader](https://npm.io/package/postcss-loader.md) ~1.3.3
- [babel-preset-react](https://npm.io/package/babel-preset-react.md) ^6.24.1
- [babel-preset-stage-0](https://npm.io/package/babel-preset-stage-0.md) ^6.24.1
- [babel-preset-es2015-ie](https://npm.io/package/babel-preset-es2015-ie.md) ^6.7.0
- [less-plugin-npm-import](https://npm.io/package/less-plugin-npm-import.md) ^2.1.0
- [map-json-webpack-plugin](https://npm.io/package/map-json-webpack-plugin.md) ~1.2.0
- [bigbrother-webpack-plugin](https://npm.io/package/bigbrother-webpack-plugin.md) ^1.1.2
- [extract-text-webpack-plugin](https://npm.io/package/extract-text-webpack-plugin.md) ~1.0.1
- [friendly-errors-webpack-plugin](https://npm.io/package/friendly-errors-webpack-plugin.md) ^1.6.1
- [babel-plugin-add-module-exports](https://npm.io/package/babel-plugin-add-module-exports.md) ~0.2.1
- [build-statistics-webpack-plugin](https://npm.io/package/build-statistics-webpack-plugin.md) ^1.0.3
- [case-sensitive-paths-webpack-plugin](https://npm.io/package/case-sensitive-paths-webpack-plugin.md) ^2.0.0
- [babel-plugin-transform-decorators-legacy](https://npm.io/package/babel-plugin-transform-decorators-legacy.md) ^1.3.4

## Recent versions

- 1.0.8 (latest) — 2019-03-05
- 2.0.0-alpha.12 (next) — 2017-09-22
- 0.6.0-beta1 (beta) — 2016-03-03
- 1.0.7 — 2018-12-29
- 1.0.6 — 2018-12-28
- 1.0.5 — 2018-12-28
- 0.11.3 — 2018-12-28
- 1.0.4 — 2018-11-30
- 1.0.3 — 2018-11-30
- 2.0.0-alpha.11 — 2017-09-20
- 2.0.0-alpha.10 — 2017-09-20
- 2.0.0-alpha.9 — 2017-09-20
- 2.0.0-alpha.6 — 2017-09-20
- 2.0.0-alpha.5 — 2017-09-20
- 2.0.0-alpha.4 — 2017-09-20
- … 58 more at https://npm.io/package/atool-build/versions

## README

# atool-build

[![NPM version](https://img.shields.io/npm/v/atool-build.svg?style=flat)](https://npmjs.org/package/atool-build)
[![Build Status](https://img.shields.io/travis/ant-tool/atool-build.svg?style=flat)](https://travis-ci.org/ant-tool/atool-build)
[![Coverage Status](https://img.shields.io/coveralls/ant-tool/atool-build.svg?style=flat)](https://coveralls.io/r/ant-tool/atool-build)
[![NPM downloads](http://img.shields.io/npm/dm/atool-build.svg?style=flat)](https://npmjs.org/package/atool-build)
[![Dependency Status](https://david-dm.org/ant-tool/atool-build.svg)](https://david-dm.org/ant-tool/atool-build)

基于 webpack 的构建封装.

----

## 特性

- 基于 webpack 实现
- 支持通过 `webpack.config.js` 进行扩展 webpack 的配置项
- 支持 [stage-0](https://babeljs.io/docs/plugins/preset-stage-0), [es2015](https://babeljs.io/docs/plugins/preset-es2015), react 和 less
- 支持 hash 模式的构建, 并生成映射表 `map.json`
- 支持 typescript

## 安装

```bash
$ npm i atool-build --save
```

## 使用

```bash
$ atool-build [options]
```

### 命令行参数

```bash
$ atool-build -h

  Usage: atool-build [options]

  Options:

    -h, --help                output usage information
    -v, --version             output the version number
    -o, --output-path <path>  output path
    -w, --watch [delay]       watch file changes and rebuild
    --hash                    build with hash and output map.json
    --publicPath <publicPath> webpack publicPath
    --devtool <devtool>       sourcemap generate method, default is null
    --config <path>           custom config path, default is webpack.config.js
    --no-compress             build without compress
    --silent                  build without notify
```

### 配置扩展

如果需要对内置的 webpack 配置进行修改, 可在项目根目录新建 `webpack.config.js` 进行扩展.


让 `webpack.config.js` 输出 `Function`, 比如:

```javascript
var path = require("path");
module.exports = function(webpackConfig) {
  webpackConfig.output.path = path.join(__dirname, './public');
  return webpackConfig;
};
```

参数:

- `webpackConfig` -- 默认配置, 修改后返回新的配置


详细内容：[atool-build 基本使用](http://ant-tool.github.io/atool-build.html)


## FAQ

> 如何在 webpack.config.js 中引用 webpack ? (新增插件需要)

`var webpack = require('atool-build/lib/webpack');`

[#32](https://github.com/ant-tool/atool-build/issues/32)

> 为什么 TypeScript 错误不会显示？

在 `webpack.config.js` 中配置：

```javascript
module.exports = function(webpack) {
  webpack.ts.transpileOnly = false;
}
```

关闭这个选项后如果项目较大，构建速度会变慢，可以在开发环境打开，发布的时候再关闭。

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