Skip to content

A plugin to compile JS for Hexo, using Babel.

License

Notifications You must be signed in to change notification settings

theme-particlex/hexo-babel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hexo-Babel

Hexo-Babel 插件,使用 Babel 编译转换 JS 文件。

1. 安装

pnpm add hexo-babel

2. 配置

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

options 详见 Options · Babel@babel/preset-env · Babel

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

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

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

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

Releases

No releases published

Packages

No packages published