#devdependencies

7 messages · Page 1 of 1 (latest)

cold knoll
#

Should I have a separate dependencies and devdependencies section in my package.json file?
this is my current file

{
  "name": "accountabilitybunnies",
  "type": "module",
  "version": "0.0.1",
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro check && astro build --remote",
    "preview": "astro preview",
    "astro": "astro"
  },
  "dependencies": {
    "@astrojs/check": "^0.7.0",
    "@astrojs/db": "^0.11.5",
    "@astrojs/netlify": "^5.3.0",
    "astro": "^4.10.2",
    "sharp": "^0.33.4",
    "typescript": "^5.4.2"
  }
}
golden owlBOT
#

Hi @cold knoll. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

In your package.json file, you can specify two kinds of dependencies: dependencies and devDependencies. In most cases, these work the same way: Astro needs all dependencies at build time, and your package manager will install both.

However, the Astro documentation recommends putting all of your dependencies in dependencies to start, and only use devDependencies if you find a specific need to do so. This is because Astro needs all dependencies at build time, and your package manager will install both dependencies and devDependencies.

So, in your case, if all the listed dependencies are required for the build, you can keep them under dependencies. If you find some packages that are only needed for development and not for the build, you can move them to devDependencies.

Here is the source (https://docs.astro.build/en/basics/project-structure/#packagejson) for your reference.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@cold knoll kapa.ai is still learning and improving, please let us know how it did by reacting below

cold knoll
#

@golden owl do you recommend any devDependencies for astro

golden owlBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Astro doesn't specifically recommend any devDependencies. The choice of devDependencies largely depends on your development environment and the tools you use for development purposes such as linters, formatters, testing libraries, etc.

However, it's important to note that when working with Astro in a monorepo setup, project dependencies should be added in each project’s own package.json file. Also, if you're using integrations like @astrojs/react, you should install the official react and react-dom packages alongside your integration. The integration will then pull from these packages automatically.

Here are the sources for your reference:


Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: