Skip to content

Commit 4529f77

Browse files
authored
[docs] Update compiling with babel section (#1298)
1 parent 448dbdb commit 4529f77

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

packages/lit-dev-content/site/docs/v3/tools/publishing.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,29 +78,30 @@ To compile a Lit component that uses proposed JavaScript features not yet includ
7878
Install Babel and the Babel plugins you need. For example:
7979

8080
```sh
81-
npm install --save-dev @babel/core
82-
npm install --save-dev @babel/plugin-proposal-class-properties
83-
npm install --save-dev @babel/plugin-proposal-decorators
81+
npm install --save-dev \
82+
@babel/core \
83+
@babel/cli \
84+
@babel/preset-env \
85+
@babel/plugin-proposal-decorators
8486
```
8587

8688
Configure Babel. For example:
8789

88-
**babel.config.js**
90+
**babel.config.json**
8991

90-
```js
91-
const assumptions = {
92-
"setPublicClassFields": true
93-
};
94-
95-
const plugins = [
96-
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true } ],
97-
["@babel/plugin-proposal-class-properties"],
98-
99-
];
100-
101-
module.exports = { assumptions, plugins };
92+
```json
93+
{
94+
"presets": [
95+
["@babel/preset-env", {"targets": "defaults"}]
96+
],
97+
"plugins": [
98+
["@babel/plugin-proposal-decorators", {"version": "2023-05"}]
99+
]
100+
}
102101
```
103102

103+
You can adjust the `"targets"` option to target browsers you wish to support. See [`@babel/preset-env`](https://babeljs.io/docs/babel-preset-env) for available options.
104+
104105
You can run Babel via a bundler plugin such as [@rollup/plugin-babel](https://www.npmjs.com/package/@rollup/plugin-babel), or from the command line. See the [Babel documentation](https://babeljs.io/docs/en/) for more information.
105106

106107
## Publishing best practices

0 commit comments

Comments
 (0)