diff --git a/src/commands/dev/index.js b/src/commands/dev/index.js index c77ba8f..a542e6a 100644 --- a/src/commands/dev/index.js +++ b/src/commands/dev/index.js @@ -77,6 +77,13 @@ async function startProxy(settings, addonUrls) { function startDevServer(settings, log, error) { if (settings.noCmd) { const StaticServer = require('static-dev-server') + if (!settings.dist) { + log( + 'Unable to determine public folder for the dev server.\nSetup a netlify.toml file with a [dev] section to specify your dev server settings.' + ) + process.exit(1) + } + const server = new StaticServer({ rootPath: settings.dist, name: 'netlify-dev', @@ -115,7 +122,9 @@ class DevCommand extends Command { const {flags, args} = this.parse(DevCommand) const {api, site, config} = this.netlify const functionsDir = - flags.functions || (config.build && config.build.functions) + flags.functions || + (config.dev && config.dev.functions) || + (config.build && config.build.functions) const addonUrls = {} if (site.id && !flags.offline) { const accessToken = await this.authenticate() @@ -145,11 +154,14 @@ class DevCommand extends Command { let settings = serverSettings(config.dev) if (!(settings && settings.cmd)) { this.log('No dev server detected, using simple static server') + const dist = + (config.dev && config.dev.publish) || + (config.build && config.build.publish) settings = { noCmd: true, port: 8888, proxyPort: 3999, - dist: config.build && config.build.publish, + dist, } } startDevServer(settings, this.log, this.error)
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: