|
1
|
--- |
|
2
|
sidebar_label: "build" |
|
3
|
sidebar_position: 5 |
|
4
|
--- |
|
5
|
|
|
6
|
import { Table } from "docs-ui" |
|
7
|
|
|
8
|
export const metadata = { |
|
9
|
title: `build Command - Medusa CLI Reference`, |
|
10
|
} |
|
11
|
|
|
12
|
# {metadata.title} |
|
13
|
|
|
14
|
Create a standalone build of the Medusa application that you can deploy to production. |
|
15
|
|
|
16
|
This creates a build that: |
|
17
|
|
|
18
|
- Doesn't rely on the source TypeScript files. |
|
19
|
- Can be copied to a production server reliably. |
|
20
|
|
|
21
|
The build is output to a new `.medusa/server` directory. |
|
22
|
|
|
23
|
```bash npx2yarn |
|
24
|
npx medusa build |
|
25
|
``` |
|
26
|
|
|
27
|
Refer to the [Build Medusa Application](!docs!/learn/build) guide for next steps. |
|
28
|
|
|
29
|
## Options |
|
30
|
|
|
31
|
<Table> |
|
32
|
<Table.Header> |
|
33
|
<Table.Row> |
|
34
|
<Table.HeaderCell> |
|
35
|
Option |
|
36
|
</Table.HeaderCell> |
|
37
|
<Table.HeaderCell> |
|
38
|
Description |
|
39
|
</Table.HeaderCell> |
|
40
|
<Table.HeaderCell> |
|
41
|
Default |
|
42
|
</Table.HeaderCell> |
|
43
|
</Table.Row> |
|
44
|
</Table.Header> |
|
45
|
<Table.Body> |
|
46
|
<Table.Row> |
|
47
|
<Table.Cell> |
|
48
|
|
|
49
|
`--admin-only` |
|
50
|
|
|
51
|
</Table.Cell> |
|
52
|
<Table.Cell> |
|
53
|
|
|
54
|
Whether to build only the admin to host it separately. If this option is not passed, the admin is built to the `.medusa/server/public/admin` directory. When this option is passed, the admin is built to the `.medusa/admin` directory instead. |
|
55
|
|
|
56
|
</Table.Cell> |
|
57
|
<Table.Cell> |
|
58
|
|
|
59
|
`false` |
|
60
|
|
|
61
|
</Table.Cell> |
|
62
|
</Table.Row> |
|
63
|
<Table.Row> |
|
64
|
<Table.Cell> |
|
65
|
|
|
66
|
`--lint` / `--no-lint` (v2.16.0+) |
|
67
|
|
|
68
|
</Table.Cell> |
|
69
|
<Table.Cell> |
|
70
|
|
|
71
|
Run the Medusa linter before building. Pass `--no-lint` to skip linting. Enabled by default only when `@medusajs/eslint-plugin` is installed in the project. Linting is also skipped automatically when no `eslint.config.js` is found in the project root. |
|
72
|
|
|
73
|
</Table.Cell> |
|
74
|
<Table.Cell> |
|
75
|
|
|
76
|
`true` when `@medusajs/eslint-plugin` is installed, `false` otherwise |
|
77
|
|
|
78
|
</Table.Cell> |
|
79
|
</Table.Row> |
|
80
|
<Table.Row> |
|
81
|
<Table.Cell> |
|
82
|
|
|
83
|
`--fix` (v2.16.0+) |
|
84
|
|
|
85
|
</Table.Cell> |
|
86
|
<Table.Cell> |
|
87
|
|
|
88
|
Auto-fix lint issues where possible before building. |
|
89
|
|
|
90
|
</Table.Cell> |
|
91
|
<Table.Cell> |
|
92
|
|
|
93
|
`false` |
|
94
|
|
|
95
|
</Table.Cell> |
|
96
|
</Table.Row> |
|
97
|
<Table.Row> |
|
98
|
<Table.Cell> |
|
99
|
|
|
100
|
`--quiet` (v2.16.0+) |
|
101
|
|
|
102
|
</Table.Cell> |
|
103
|
<Table.Cell> |
|
104
|
|
|
105
|
Report lint errors only, suppressing warnings. |
|
106
|
|
|
107
|
</Table.Cell> |
|
108
|
<Table.Cell> |
|
109
|
|
|
110
|
`false` |
|
111
|
|
|
112
|
</Table.Cell> |
|
113
|
</Table.Row> |
|
114
|
</Table.Body> |
|
115
|
</Table> |
|
116
|
|
|
117
|
--- |
|
118
|
|
|
119
|
## Build Medusa Admin |
|
120
|
|
|
121
|
By default, the Medusa Admin is built to the `.medusa/server/public/admin` directory. |
|
122
|
|
|
123
|
If you want a separate build to host the admin as a standalone application, such as on Vercel, pass the `--admin-only` option as explained in the [Options](#options) section. This outputs the admin to the `.medusa/admin` directory instead. |
|
124
|
|
|
125
|
By default, the Medusa Admin dashboard is hosted at the `/app` path. You can change it with the `admin.path` configuration in `medusa-config.ts`. |
|
126
|
|
|
127
|
For example, to serve it from the root path `/` when hosting on a separate domain: |
|
128
|
|
|
129
|
```ts title="medusa-config.ts" |
|
130
|
module.exports = defineConfig({ |
|
131
|
admin: { |
|
132
|
path: "/", |
|
133
|
backendUrl: process.env.MEDUSA_BACKEND_URL, |
|
134
|
}, |
|
135
|
// ... |
|
136
|
}) |
|
137
|
``` |
|
138
|
|
|
139
|
The admin will now run at `/` of your application. For example, at `acme.com`. |