@@ -77,6 +77,13 @@ async function startProxy(settings, addonUrls) {
77
77
function startDevServer ( settings , log , error ) {
78
78
if ( settings . noCmd ) {
79
79
const StaticServer = require ( 'static-dev-server' )
80
+ if ( ! settings . dist ) {
81
+ log (
82
+ 'Unable to determine public folder for the dev server.\nSetup a netlify.toml file with a [dev] section to specify your dev server settings.'
83
+ )
84
+ process . exit ( 1 )
85
+ }
86
+
80
87
const server = new StaticServer ( {
81
88
rootPath : settings . dist ,
82
89
name : 'netlify-dev' ,
@@ -115,7 +122,9 @@ class DevCommand extends Command {
115
122
const { flags, args} = this . parse ( DevCommand )
116
123
const { api, site, config} = this . netlify
117
124
const functionsDir =
118
- flags . functions || ( config . build && config . build . functions )
125
+ flags . functions ||
126
+ ( config . dev && config . dev . functions ) ||
127
+ ( config . build && config . build . functions )
119
128
const addonUrls = { }
120
129
if ( site . id && ! flags . offline ) {
121
130
const accessToken = await this . authenticate ( )
@@ -145,11 +154,14 @@ class DevCommand extends Command {
145
154
let settings = serverSettings ( config . dev )
146
155
if ( ! ( settings && settings . cmd ) ) {
147
156
this . log ( 'No dev server detected, using simple static server' )
157
+ const dist =
158
+ ( config . dev && config . dev . publish ) ||
159
+ ( config . build && config . build . publish )
148
160
settings = {
149
161
noCmd : true ,
150
162
port : 8888 ,
151
163
proxyPort : 3999 ,
152
- dist : config . build && config . build . publish ,
164
+ dist,
153
165
}
154
166
}
155
167
startDevServer ( settings , this . log , this . error )
0 commit comments