@babel/plugin-syntax-bigint
Traduction Bêta Non Officielle
Cette page a été traduite par PageTurner AI (bêta). Non approuvée officiellement par le projet. Vous avez trouvé une erreur ? Signaler un problème →
info
Ce plugin est inclus dans @babel/preset-env, dans la spécification ES2020
note
Syntaxe uniquement
Ce plugin permet uniquement l'analyse syntaxique de cette fonctionnalité. Babel ne prend pas en charge la transformation des BigInts. Une recommandation est d'utiliser la bibliothèque JSBI puis d'exécuter babel-plugin-transform-jsbi-to-bigint pour effectuer une migration vers BigInt à l'avenir.
Installation
- npm
- Yarn
- pnpm
- Bun
npm install --save-dev @babel/plugin-syntax-bigint
yarn add --dev @babel/plugin-syntax-bigint
pnpm add --save-dev @babel/plugin-syntax-bigint
bun add --dev @babel/plugin-syntax-bigint
Utilisation
Avec un fichier de configuration (Recommandé)
babel.config.json
{
"plugins": ["@babel/plugin-syntax-bigint"]
}
Via CLI
Shell
babel --plugins @babel/plugin-syntax-bigint script.js
Via l'API Node
JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-syntax-bigint"],
});