Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@notlmn @doms
43 lines (30 sloc) 837 Bytes
---
id: babel-plugin-syntax-optional-chaining
title: @babel/plugin-syntax-optional-chaining
sidebar_label: syntax-optional-chaining
---

Syntax only

It's unlikely you want to use this plugin directly as it only enables Babel to parse this syntax. Instead, use plugin-proposal-optional-chaining to both parse and transform this syntax.

Installation

npm install --save-dev @babel/plugin-syntax-optional-chaining

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["@babel/plugin-syntax-optional-chaining"]
}

Via CLI

babel --plugins @babel/plugin-syntax-optional-chaining script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["@babel/plugin-syntax-optional-chaining"]
});
You can’t perform that action at this time.