Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Delightful library bundler.
- 🚀 Fast, zero-config by default.
- 📦 Using Rollup under the hood.
- 🚗 Automatically transforms JS files using Buble, Babel or TypeScript.
- 🧩 Bundles TypeScript declarations into a single `.d.ts` file.
- 💅 Built-in support for CSS, Sass, Stylus, Less and CSS modules.
- 🎶 Ridiculously easy to use Rollup plugins if you want.
- 🚨 Friendly error logging experience.
Expand Down Expand Up @@ -35,3 +36,9 @@ And you want minified bundles?
```bash
bili --format esm-min --format cjs-min
```

Bundle TypeScript declarations too:

```bash
bili src/index.ts --dts
```
19 changes: 18 additions & 1 deletion docs/recipes/javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
presets: ['bili/babel'],
plugins: [
// Add your babel plugins...
]
],
}
```

Expand Down Expand Up @@ -53,6 +53,23 @@ We automatically use [rollup-plugin-typescript2](https://github.com/ezolenko/rol
yarn add typescript rollup-plugin-typescript2 --dev
```

Bili can also bundle emitted declarations into one `.d.ts` entry file:

```bash
bili src/index.ts --dts
```

Or choose the declaration bundle file name:

```js
// bili.config.js
module.exports = {
output: {
dts: 'index.d.ts',
},
}
```

## Use Babel with TypeScript

By default Babel is also used for `.ts` files, it will process the file after TypeScript. It's recommended to set `compilerOptions.target` to `es2017` or above in `tsconfig.json` and let Babel transform the code to ES5 instead. If you want to disable Babel, set `plugins: { babel: false }` in your Bili config file.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"chalk": "^4.1.0",
"ora": "^4.0.4",
"rollup": "^2.16.1",
"rollup-plugin-dts": "1.3.0",
"rollup-plugin-hashbang": "^2.2.2",
"rollup-plugin-postcss": "^3.1.2",
"rollup-plugin-terser": "^6.1.0",
Expand Down
5 changes: 5 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ cli
'--no-map',
'Disable source maps, enabled by default for minified bundles'
)
.option(
'--dts [fileName]',
'Bundle TypeScript declarations into a single .d.ts file'
)
.option('--map-exclude-sources', 'Exclude source code in source maps')
.option('--no-async-pro, --no-async-to-promises', 'Leave async/await as is')
.option('--concurrent', 'Build concurrently')
Expand All @@ -70,6 +74,7 @@ cli
minify: options.minify,
extractCSS: options.extractCss,
sourceMap: options.map,
dts: options.dts,
sourceMapExcludeSources: options.mapExcludeSources,
target: options.target,
},
Expand Down
Loading