# @treynb/zbuild

> build for react typescript project

Latest version **0.2.0** (published 2020-08-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @treynb/zbuild
pnpm add @treynb/zbuild
yarn add @treynb/zbuild
bun add @treynb/zbuild
```

Provides the command `zbuild`.

## 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.2.0 |
| Published | 2020-08-13 |
| First published | 2020-07-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.15.0 |
| Dependencies | 24 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| Author | jacky |
| Maintainers | yuyang041060120 |

## Links

- npm: https://www.npmjs.com/package/@treynb/zbuild
- Repository: https://github.com/yuyang041060120/zbuild
- Homepage: https://github.com/yuyang041060120/zbuild#readme
- Issues: https://github.com/yuyang041060120/zbuild/issues
- npm.io page: https://npm.io/package/@treynb/zbuild

## Dependencies (24)

- [rimraf](https://npm.io/package/rimraf.md) ^3.0.2
- [core-js](https://npm.io/package/core-js.md) ^3.6.5
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.4
- [webpack](https://npm.io/package/webpack.md) ^4.43.0
- [commander](https://npm.io/package/commander.md) ^5.1.0
- [css-loader](https://npm.io/package/css-loader.md) ^3.6.0
- [typescript](https://npm.io/package/typescript.md) ^3.9.6
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.10.4
- [less-loader](https://npm.io/package/less-loader.md) ^6.2.0
- [webpack-cli](https://npm.io/package/webpack-cli.md) ^3.3.12
- [babel-loader](https://npm.io/package/babel-loader.md) ^8.1.0
- [style-loader](https://npm.io/package/style-loader.md) ^1.2.1
- [webpack-merge](https://npm.io/package/webpack-merge.md) ^5.0.7
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.10.4
- [webpack-dev-server](https://npm.io/package/webpack-dev-server.md) ^3.11.0
- [@babel/preset-react](https://npm.io/package/@babel/preset-react.md) ^7.10.4
- [html-webpack-plugin](https://npm.io/package/html-webpack-plugin.md) ^4.3.0
- [terser-webpack-plugin](https://npm.io/package/terser-webpack-plugin.md) ^3.0.6
- [mini-css-extract-plugin](https://npm.io/package/mini-css-extract-plugin.md) ^0.9.0
- [@babel/preset-typescript](https://npm.io/package/@babel/preset-typescript.md) ^7.10.4
- [@babel/plugin-transform-runtime](https://npm.io/package/@babel/plugin-transform-runtime.md) ^7.10.4
- [optimize-css-assets-webpack-plugin](https://npm.io/package/optimize-css-assets-webpack-plugin.md) ^5.0.3
- [@babel/plugin-proposal-class-properties](https://npm.io/package/@babel/plugin-proposal-class-properties.md) ^7.10.4
- [@babel/plugin-proposal-optional-chaining](https://npm.io/package/@babel/plugin-proposal-optional-chaining.md) ^7.10.4

## Recent versions

- 0.2.0 (latest) — 2020-08-13
- 0.3.0-beta.0 (beta) — 2020-11-20
- 0.1.1 — 2020-08-01
- 0.1.0 — 2020-07-26

## README

## 简介

快速构建React Typescript 项目

## 安装

```
npm install @treynb/zbuild -D
```

## 开发

- 默认 entry 为 src/index.tsx，可以通过自定义配置覆盖
- 需要在项目根目录下添加 tsconfig.json，可以通过 tsc --init 生成，注意把 noEmit 设置为 true
- 配置 package.json scripts

```
"scripts": {
  "dev": "zbuild dev",
  "prod": "zbuild prod"
}
```

安装依赖并启动服务

```
npm install
npm run dev
```

访问 http://localhost:8080


## 构建目标

可以在根目录下添加.browserslistrc，默认defaults，详细见 https://github.com/browserslist/browserslist#full-list


## 自定义配置

默认提供了一套构建配置，为了满足灵活性可以进行覆盖，在根目录下添加配置文件，例如

`webpack.config.js`

```
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = (env) => {
  // env 'development' 'production'

  return {
    plugins: [
      new HtmlWebpackPlugin({ template: './index.html', inject: false }),
    ],
  };
}
```

配置项和 webpack 标准配置没有区别，唯一需要注意的是 exports 一个函数，env 信息会被注入。然后配置 scripts

```json
"scripts": {
  "dev": "zbuild dev -c webpack.config.js",
  "prod": "zbuild prod -c webpack.config.js",
}
```

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