Updated docs regarding dependencies.

This commit is contained in:
Martin Sosic 2024-01-19 16:54:04 +01:00
parent 2d44d9c4c2
commit 11462377e2
3 changed files with 8 additions and 38 deletions

View File

@ -85,19 +85,15 @@ Make sure to use the `.cjs` extension for these config files, if you name them w
### Adding Tailwind Plugins
To add Tailwind plugins, add it to [dependencies](/docs/project/dependencies) in your `main.wasp` file and to the plugins list in your `tailwind.config.cjs` file:
To add Tailwind plugins, install them as npm development [dependencies](/docs/project/dependencies) and add them to the plugins list in your `tailwind.config.cjs` file:
```wasp title="./main.wasp" {4-5}
app todoApp {
// ...
dependencies: [
("@tailwindcss/forms", "^0.5.3"),
("@tailwindcss/typographjy", "^0.5.7"),
],
// ...
}
```shell
npm install -D @tailwindcss/forms
npm install -D @tailwindcss/typography
```
and also
```js title="./tailwind.config.cjs" {5-6}
/** @type {import('tailwindcss').Config} */
module.exports = {

View File

@ -76,9 +76,6 @@ app todoApp {
db: {
// ...
},
dependencies: [
// ...
],
emailSender: {
// ...
},
@ -127,10 +124,6 @@ The rest of the fields are covered in dedicated sections of the docs:
Database configuration. Read more in the [database configuration section](/docs/data-model/backends) of the docs.
- `dependencies: [(string, string)]`
List of npm dependencies for your app. Read more in the [dependencies section](/docs/project/dependencies) of the docs.
- `emailSender: dict`
Email sender configuration. Read more in the [email sending section](/docs/advanced/email) of the docs.

View File

@ -2,31 +2,12 @@
title: Dependencies
---
Specifying npm dependencies in Wasp project is done via the `dependencies` field in the `app` declaration, in the following way:
```wasp
app MyApp {
title: "My app",
// ...
dependencies: [
("redux", "^4.0.5"),
("react-redux", "^7.1.3")
]
}
```
You will need to re-run `wasp start` after adding a dependency for Wasp to pick it up.
The quickest way to find out the latest version of a package is to run:
```shell
npm view <package-name> version
```
Specifying npm dependencies in Wasp project is done in a typical way for JS projects: via [package.json](https://docs.npmjs.com/cli/configuring-npm/package-json) file at the top level of the project, via the `dependencies` (or `devDependencies`) field.
:::note Using Packages that are Already Used by Wasp Internally
In the current implementation of Wasp, if Wasp is already internally using a certain npm dependency with a certain version specified, you are not allowed to define that same npm dependency yourself while specifying _a different version_.
If you do that, you will get an error message telling you which exact version you have to use for that dependency.
This means Wasp _dictates exact versions of certain packages_, so for example you can't choose version of React you want to use.
We are currently working on a restructuring that will solve this and some other quirks that the current dependency system has: check [issue #734](https://github.com/wasp-lang/wasp/issues/734) to follow our progress.
We are currently working on a restructuring that will solve this and some other quirks: check [issue #734](https://github.com/wasp-lang/wasp/issues/734) to follow our progress.
:::