Skip to content

Commit 6b267a9

Browse files
author
Matthew Sweeney
authored
add optimized framework output directory warning (#1425)
1 parent f6c14a0 commit 6b267a9

File tree

2 files changed

+45
-5
lines changed

2 files changed

+45
-5
lines changed

pages/docs/v2/advanced/platform/frequently-asked-questions.mdx

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
import Doc from '~/components/layout/docs'
2+
import { GenericLink } from '~/components/text/link'
3+
import Note from '~/components/text/note'
4+
import Caption from '~/components/text/caption'
5+
import { InlineCode } from '~/components/text/code'
26

37
export const meta = {
48
title: 'Frequently Asked Questions',
59
description: 'A list of frequently asked questions relating to deployments.',
610
editUrl: 'pages/docs/v2/advanced/platform/frequently-asked-questions.mdx',
7-
lastEdited: '2019-09-24T17:47:39.000Z'
11+
lastEdited: '2019-10-30T10:56:45.000Z'
812
}
913

1014
## Missing Public Directory
1115

1216
If your project contains a `package.json` file with a `build` [script](https://docs.npmjs.com/misc/scripts), and no `now.json` configuration, it is expected to output its static files into a directory named `public`, at the root of the project, when the `build` [script](https://docs.npmjs.com/misc/scripts) is executed.
1317

18+
<Note type="warning">
19+
If you are using an{' '}
20+
<GenericLink href="/docs/v2/build-step/#optimized-frameworks">
21+
optimized framework
22+
</GenericLink>
23+
, you must use the default output directory provided by the framework.
24+
</Note>
25+
1426
You are seeing this error because your setup did not satisfy the above constraint.
1527

1628
To resolve this error, configure your project to place its static output files into a `public` directory, at the root of your project, when the `build` [script](https://docs.npmjs.com/misc/scripts) from your `package.json` file is invoked.
@@ -20,23 +32,39 @@ For example, this is how your `package.json` file might look:
2032
```json
2133
{
2234
"scripts": {
23-
"build": "my-framework build"
35+
"build": "[my-framework] build"
2436
}
2537
}
2638
```
2739

40+
<Caption>
41+
An example <InlineCode>build</InlineCode> script in a{' '}
42+
<InlineCode>package.json</InlineCode> file.
43+
</Caption>
44+
2845
If you are seeing this error with a similar `build` script already, you may need to adjust the command to direct its static output files into the `public` directory instead.
2946

47+
<Note>
48+
Consult your framework's documentation to understand how to specify the build
49+
output directory.
50+
</Note>
51+
3052
Depending on your framework, the option for this might be called `--output`, `--out`, `--output-dir` or similar:
3153

3254
```json
3355
{
3456
"scripts": {
35-
"build": "my-framework build --output public"
57+
"build": "[my-framework] build --output public"
3658
}
3759
}
3860
```
3961

62+
<Caption>
63+
An example <InlineCode>build</InlineCode> script in a{' '}
64+
<InlineCode>package.json</InlineCode> file that specifies the output
65+
directory.
66+
</Caption>
67+
4068
Once you have done this, the error will disappear since the output will be the expected directory, `public`.
4169

4270
## Missing Build Script
@@ -48,11 +76,17 @@ When properly configured, your `package.json` file would look similar to this:
4876
```json
4977
{
5078
"scripts": {
51-
"build": "my-framework build --output public"
79+
"build": "[my-framework] build --output public"
5280
}
5381
}
5482
```
5583

84+
<Caption>
85+
An example <InlineCode>build</InlineCode> script in a{' '}
86+
<InlineCode>package.json</InlineCode> file that specifies the output
87+
directory.
88+
</Caption>
89+
5690
Once you have defined the `build` [script](https://docs.npmjs.com/misc/scripts), this error will disappear. Furthermore, it will not be displayed if you are using `package.json` purely to provide dependencies for your Serverless Functions located inside the `api` directory.
5791

5892
## Platform Version Detection

pages/docs/v2/build-step.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ export const meta = {
1818
title: 'Build Step',
1919
description: 'Providing ZEIT Now with a build step.',
2020
editUrl: 'pages/docs/v2/build-step.mdx',
21-
lastEdited: '2019-10-22T15:47:35.000Z'
21+
lastEdited: '2019-10-30T10:56:45.000Z'
2222
}
2323

2424
When you make a deployment with ZEIT Now, the first step is the build step. Now recognizes a custom `build` script, with that build script outputting your app into the `public` directory.
2525

2626
Now also supports optimized frameworks that only need to be created and then they are ready to deploy with [Now CLI](/download) from the terminal.
2727

28+
<Note type="warning">
29+
If you are using an{' '}
30+
<GenericLink href="#optimized-frameworks">optimized framework</GenericLink>,
31+
you must use the default output directory provided by the framework.
32+
</Note>
33+
2834
You are also able to use [environment variables](#using-environment-variables-and-secrets) (including secrets) in your builds if you do not want to hardcode values for the build.
2935

3036
## Optimized Frameworks

0 commit comments

Comments
 (0)