Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

atool-build

ant-tool881MITdeprecated1.0.8

No longer maintained, please consider using https://umijs.org. If you work at Ant Financial please refer to https://bigfish.alipay.com/doc/tnyo3y.

Build tool based on webpack

readme

atool-build

NPM version Build Status Coverage Status NPM downloads Dependency Status

基于 webpack 的构建封装.


特性

  • 基于 webpack 实现
  • 支持通过 webpack.config.js 进行扩展 webpack 的配置项
  • 支持 stage-0, es2015, react 和 less
  • 支持 hash 模式的构建, 并生成映射表 map.json
  • 支持 typescript

安装

$ npm i atool-build --save

使用

$ atool-build [options]

命令行参数

$ 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, 比如:

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

参数:

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

详细内容:atool-build 基本使用

FAQ

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

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

#32

为什么 TypeScript 错误不会显示?

webpack.config.js 中配置:

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

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

changelog

History


1.0.0

0.11.1

  • enhancement: throw a message when webpack entry is empty

0.11.0

0.10.1

  • revert: 回滚 svg-sprite-loader
  • test: 补充用例 svg 和 common

0.10.0

0.9.0

  • upgrade typescript to 2. Ref. #221

0.8.1

  • fix: css minimize bug with postcss plugin autoprefix and postcss-loader not found. Ref. #212

0.8.0

  • enhance autoprefix for mobile. Ref. #190

0.7.17

  • support import less by transformLess, Ref. pr

0.7.16

  • adding ".json" to the extensions under resolve
  • fix cwd
  • upgrade babel-* version

0.7.15

  • enhancement theme

0.7.14

0.7.13

  • fix: args.config is absolute path
  • fix: test error

0.7.6

  • compatibility: 0.7.4 before about babelQuery

0.7.5

  • support: typescript
  • fix: process exit when watch

0.7.4

  • fix: when build is done but process does not exit, Close #165

0.7.3

  • support: .web.js

0.7.2

  • fix: should check package.json before require it

0.7.1

  • fix class inherit problem in IE9 and IE10, #126, #148
  • remove typecheck plugin, #149

0.7.0

  • add lib/transformLess

0.6.0

  • 构建日志不输出 uglifyjs 的 warning 信息,#50
  • 修改 babel 和 UglifyJsPluginConfig 配置更简单,直接通过 webpackConfig.babel 调用,#58
  • js 里 require 的 html 文件会被复制到输出目录,#53
  • 通过匹配 *.module.css 支持 css-modules,一种更好的 css 组织方式
  • 添加 NoErrorsPlugin 插件,构建出错时不生成文件
  • 支持 rucksack,详见 http://simplaio.github.io/rucksack/
  • 支持 webpackConfig 处理了 i18n 后是数组的场景,#98
  • watch 模式下精简日志信息,#86
  • 支持 decorator,#65

0.5.0

采用 postcss-loader

解决 map.json bug

0.4.3

jsx 全部转换

0.4.0

更新 webpack 相关依赖

0.3.0

支持 less 变量

0.2.0

react 不 external 了

0.1.0

初始版本