|
1 | | -# Vite plugin for sending sourcemaps to Flare |
| 1 | +# @flareapp/vite |
2 | 2 |
|
3 | | -The Flare Vite plugin helps you send sourcemaps of your compiled JavaScript code to Flare. This way, reports sent using the `@flareapp/js` will be formatted correctly. |
| 3 | +Vite build plugin for [Flare](https://flareapp.io) that uploads sourcemaps after each build. With sourcemaps, error reports sent by `@flareapp/js` will show the original source code instead of minified output. |
4 | 4 |
|
5 | | -Additionally, it automatically passes the Flare API key to `@flareapp/js`. This way, `flare.light()` works without any additional configuration. |
6 | | - |
7 | | -Check the JavaScript error tracking section in [the Flare documentation](https://flareapp.io/docs/javascript-error-tracking/installation) for more information. |
| 5 | +The plugin also injects the Flare API key and a sourcemap version identifier into your build, so `flare.light()` works without any additional configuration. |
8 | 6 |
|
9 | 7 | ## Installation |
10 | 8 |
|
11 | | -Install the plugin using NPM or Yarn: |
12 | | - |
13 | 9 | ```bash |
14 | | -yarn add @flareapp/vite |
15 | | -# or |
16 | 10 | npm install @flareapp/vite |
17 | 11 | ``` |
18 | | -Next, add the plugin to your `vite.config.js` file: |
19 | 12 |
|
20 | | -```js |
| 13 | +## Quick start |
| 14 | + |
| 15 | +Add the plugin to your `vite.config.ts`: |
| 16 | + |
| 17 | +```ts |
21 | 18 | import { defineConfig } from 'vite'; |
22 | 19 | import flareSourcemapUploader from '@flareapp/vite'; |
23 | 20 |
|
24 | 21 | export default defineConfig({ |
25 | 22 | plugins: [ |
26 | 23 | flareSourcemapUploader({ |
27 | | - key: 'YOUR API KEY HERE' |
| 24 | + key: 'YOUR_FLARE_API_KEY', |
28 | 25 | }), |
29 | 26 | ], |
30 | 27 | }); |
31 | 28 | ``` |
32 | 29 |
|
33 | | -Run the `vite build` command to make sure the sourcemaps are generated. You should see the following lines in the output: |
34 | | - |
35 | | -```bash |
36 | | -@flareapp/flare-vite-plugin-sourcemaps: Uploading 12 sourcemap files to Flare. |
37 | | -@flareapp/flare-vite-plugin-sourcemaps: Successfully uploaded sourcemaps to Flare. |
38 | | -``` |
39 | | - |
40 | | -## Configuration |
41 | | - |
42 | | -- `key: string` **(required)**: the Flare API key |
43 | | -- `base: string`: the base path of built output (defaults to Vite's base path) |
44 | | -- `runInDevelopment: boolean`: whether to upload sourcemaps when `NODE_ENV=development` or when running the dev server (defaults to `false`) |
45 | | -- `version: string`: the sourcemap version (defaults to a fresh `uuid` per build) |
46 | | -- `removeSourcemaps: boolean`: whether to remove the sourcemaps after uploading them (defaults to `false`). Comes in handy when you want to upload sourcemaps to Flare but don't want them published in your build. |
47 | | - |
48 | | -## development |
49 | | - |
50 | | -Publish a new release: |
51 | | - |
52 | | -```bash |
53 | | -npm version patch |
54 | | -npm publish |
55 | | -``` |
| 30 | +## Documentation |
56 | 31 |
|
57 | | -Tag the release: |
| 32 | +Full documentation on configuration options, sourcemap resolution, and more is available at [flareapp.io/docs/javascript/general/resolving-bundled-code](https://flareapp.io/docs/javascript/general/resolving-bundled-code). |
58 | 33 |
|
59 | | -<pre> |
60 | | -git tag <var>VERSION</var> |
61 | | -git push origin <var>VERSION</var> |
62 | | -</pre> |
| 34 | +## License |
63 | 35 |
|
64 | | -Replace <var>VERSION</var> with `v` + the version from `package.json` — for example, `v1.0.2` |
| 36 | +The MIT License (MIT). Please see [License File](../../LICENSE.md) for more information. |
0 commit comments