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
Copy file name to clipboardExpand all lines: web/docs/general/wasp-ts-config.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ Wasp TS config is an **early preview** feature, meaning it is a little rough and
78
78
}
79
79
```
80
80
81
-
5. Add `"type": "module"` to the top level of your `package.json`:
81
+
5. Add `"type": "module"` to the top level of your `package.json`, if you don't have it yet:
82
82
83
83
```json title="package.json"
84
84
{
@@ -93,19 +93,23 @@ Wasp TS config is an **early preview** feature, meaning it is a little rough and
93
93
9. Create an empty `main.wasp.ts` file and rewrite your `main.wasp.old` in it but in TypeScript.
94
94
95
95
Check out the [reference main.wasp.ts file](#reference-main-wasp-ts-file) below for details on what the TypeScript API for configuring Wasp looks like.
96
-
In short, you'll have to:
97
-
1. Import `App` from `wasp-config`
98
-
2. Create a new `app` object with `new App()`.
99
-
3. Use the `app` object to define parts of your web app like `auth`, `pages`, `query`, `api`...
100
-
4. Export the `app` from your file using a default export.
96
+
In short, you'll have to:
97
+
1. Import `App` from `wasp-config`
98
+
2. Create a new `app` object with `new App()`.
99
+
3. Use the `app` object to define parts of your web app like `auth`, `pages`, `query`, `api`...
100
+
4. Export the `app` from your file using a default export.
101
101
102
102
You can manually do the rewrite using the reference file and TS types as guides (IDE support should work for you in `main.wasp.ts`), or you can (and we recommend it!) give the reference main.wasp.ts file to the LLM of your choice and tell it to rewrite your `main.wasp` while following the format in the reference file: we had great results with this!
103
103
10. Run `wasp start` to run your app! If you got everything right, your app should work exactly like it did before. The only difference is that it's now reading the Wasp config from `main.wasp.ts` instead of `main.wasp`.
104
104
:::tip
105
-
Don't forget to have the database running or do the db migrations if needed, as you would normally when running your app in development.
105
+
Don't forget, during `wasp start`, to have the database running or do the db migrations if needed, as you would normally when running your app in development.
106
106
:::
107
107
11. That is it, you are now using Wasp TS config! You can delete `main.wasp.old` file now if you still have it around.
108
108
109
+
:::caution
110
+
If you run `wasp clean` or remove `node_modules` on your own, you will have to rerun `wasp ts-setup`!
111
+
:::
112
+
109
113
Got stuck on any of these steps? Let us know in our <DiscordLink /> and we will help!
Copy file name to clipboardExpand all lines: web/versioned_docs/version-0.15.0/general/wasp-ts-config.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ Wasp TS config is an **early preview** feature, meaning it is a little rough and
78
78
}
79
79
```
80
80
81
-
5. Add `"type": "module"` to the top level of your `package.json`:
81
+
5. Add `"type": "module"` to the top level of your `package.json`, if you don't have it yet:
82
82
83
83
```json title="package.json"
84
84
{
@@ -93,19 +93,23 @@ Wasp TS config is an **early preview** feature, meaning it is a little rough and
93
93
9. Create an empty `main.wasp.ts` file and rewrite your `main.wasp.old` in it but in TypeScript.
94
94
95
95
Check out the [reference main.wasp.ts file](#reference-main-wasp-ts-file) below for details on what the TypeScript API for configuring Wasp looks like.
96
-
In short, you'll have to:
97
-
1. Import `App` from `wasp-config`
98
-
2. Create a new `app` object with `new App()`.
99
-
3. Use the `app` object to define parts of your web app like `auth`, `pages`, `query`, `api`...
100
-
4. Export the `app` from your file using a default export.
96
+
In short, you'll have to:
97
+
1. Import `App` from `wasp-config`
98
+
2. Create a new `app` object with `new App()`.
99
+
3. Use the `app` object to define parts of your web app like `auth`, `pages`, `query`, `api`...
100
+
4. Export the `app` from your file using a default export.
101
101
102
102
You can manually do the rewrite using the reference file and TS types as guides (IDE support should work for you in `main.wasp.ts`), or you can (and we recommend it!) give the reference main.wasp.ts file to the LLM of your choice and tell it to rewrite your `main.wasp` while following the format in the reference file: we had great results with this!
103
103
10. Run `wasp start` to run your app! If you got everything right, your app should work exactly like it did before. The only difference is that it's now reading the Wasp config from `main.wasp.ts` instead of `main.wasp`.
104
104
:::tip
105
-
Don't forget to have the database running or do the db migrations if needed, as you would normally when running your app in development.
105
+
Don't forget, during `wasp start`, to have the database running or do the db migrations if needed, as you would normally when running your app in development.
106
106
:::
107
107
11. That is it, you are now using Wasp TS config! You can delete `main.wasp.old` file now if you still have it around.
108
108
109
+
:::caution
110
+
If you run `wasp clean` or remove `node_modules` on your own, you will have to rerun `wasp ts-setup`!
111
+
:::
112
+
109
113
Got stuck on any of these steps? Let us know in our <DiscordLink /> and we will help!
0 commit comments