Skip to content

Commit 5f7ba32

Browse files
committed
docs: page about esbuild plugin
1 parent 1daf8d3 commit 5f7ba32

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

docs/.vuepress/config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ module.exports = {
5555
title: 'Rollup',
5656
path: '/guide/rollup',
5757
},
58+
{
59+
title: 'esbuild',
60+
path: '/guide/esbuild',
61+
},
5862
{
5963
title: 'Electron',
6064
path: '/guide/electron',

docs/guide/esbuild.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: esbuild Bundler Plugin
3+
---
4+
5+
::: tip Before Reading
6+
Head on over to the [Introduction](../intro/) or [Quick Start](../intro/quick-start) if you haven't already.
7+
:::
8+
9+
The esbuild plugin is a separate package, which you'll need to install:
10+
11+
```sh
12+
yarn add -D @app-config/esbuild@2
13+
```
14+
15+
Then add it to your esbuild configuration:
16+
17+
```javascript
18+
const { createPlugin: appConfig } = require('@app-config/esbuild');
19+
20+
require('esbuild')
21+
.build({
22+
bundle: true,
23+
entryPoints: ['./src/index.ts'],
24+
outfile: './dist/index.js',
25+
// this is the line we care about
26+
plugins: [appConfig()],
27+
})
28+
.catch(() => process.exit(1));
29+
```
30+
31+
This will allow you to import `@app-config/main` from your application, with all
32+
filesystem and other Node.js code stripped out (when using `bundle`).
33+
34+
```javascript
35+
import config from '@app-config/main';
36+
```

0 commit comments

Comments
 (0)