Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/theme-particlex/hexo-babel

A plugin to compile JS for Hexo, using Babel.
https://github.com/theme-particlex/hexo-babel

babel hexo hexo-plugin renderer

Last synced: 2 days ago
JSON representation

A plugin to compile JS for Hexo, using Babel.

Awesome Lists containing this project

README

        

# Hexo-Babel

[Hexo-Babel](https://github.com/theme-particlex/hexo-babel) 插件,使用 Babel 编译转换 JS 文件。

# 1. 安装

```bash
pnpm add hexo-babel
```

# 2. 配置

```yaml
babel:
options:
exclude:
- "*.min.js"
```

`options` 详见 [Options · Babel](https://babel.dev/docs/en/options) 和 [@babel/preset-env · Babel](https://babel.dev/docs/en/babel-preset-env#options)。

例如这是一种配置(要先安装 `@babel/preset-env`):

```bash
pnpm add @babel/core @babel/preset-env -D
```

```yaml
babel:
options:
presets:
- - "@babel/preset-env"
- targets: last 5 versions, not dead, > 0.3%
sourceType: script
exclude:
- "*.min.js"
```

或者不填 `options` 参数,使用 `babel.config.json`。

```json
{
"presets": [["@babel/preset-env", { "targets": "last 5 versions, not dead, > 0.3%" }]],
"sourceType": "script"
}
```