You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This guide describes how to configure [Vite](https://vite.dev/) to use [build-time import mapping](/docs/introduction/workflow#build-time-import-mapping). The guide assumes you have an `eik.json` containing at least one [`"import-map"`](/docs/reference/eik-json#import-map).
6
+
7
+
## Getting started
8
+
9
+
Install [`@eik/vite-plugin`](https://github.com/eik-lib/vite-plugin#readme), and `vite` if you haven't already.
10
+
11
+
```sh
12
+
npm install --save-dev vite @eik/vite-plugin
13
+
```
14
+
15
+
## Configure your build
16
+
17
+
Create or edit `vite.config.ts` to add the Eik plugin.
18
+
19
+
```ts
20
+
importeikfrom"@eik/vite-plugin";
21
+
import { defineConfig } from"vite";
22
+
23
+
exportdefaultdefineConfig({
24
+
plugins: [eik()],
25
+
});
26
+
```
27
+
28
+
## Run your build
29
+
30
+
Add these scripts to `package.json` if you haven't already.
31
+
32
+
```json
33
+
{
34
+
"scripts": {
35
+
"dev": "vite",
36
+
"build": "vite build"
37
+
}
38
+
}
39
+
```
40
+
41
+
Now you can run a production build using the Eik plugin by running this command.
42
+
43
+
```sh
44
+
npm run build
45
+
```
46
+
47
+
## Advanced usage
48
+
49
+
See the [plugin documentation](https://github.com/eik-lib/vite-plugin?tab=readme-ov-file#options) for advanced options on loading import maps.
0 commit comments