@babel/plugin-syntax-bigint
注意
仅语法
¥Syntax only
此插件仅启用对此功能的解析。Babel 不支持转换 BigInts。一个建议是使用 JSBI 库并最终运行 babel-plugin-transform-jsbi-to-bigint
以在将来将其代码修改为 BigInt。
¥This plugin only enables parsing of this feature. Babel doesn't support transforming BigInts. One recommendation is to use the JSBI library and eventually run babel-plugin-transform-jsbi-to-bigint
to codemod it to BigInt in the future.
安装
¥Installation
- npm
- Yarn
- pnpm
npm install --save-dev @babel/plugin-syntax-bigint
yarn add --dev @babel/plugin-syntax-bigint
pnpm add --save-dev @babel/plugin-syntax-bigint
用法
¥Usage
使用配置文件(推荐)
¥With a configuration file (Recommended)
babel.config.json
{
"plugins": ["@babel/plugin-syntax-bigint"]
}
通过 CLI
¥Via CLI
Shell
babel --plugins @babel/plugin-syntax-bigint script.js
通过 Node API
¥Via Node API
JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-syntax-bigint"],
});
参考
¥References