Skip to content

Commit

Permalink
Merge pull request #532 from netlify/raees/dir-flag-fix
Browse files Browse the repository at this point in the history
Dev: Respect the dir flag for serving directory
  • Loading branch information
RaeesBhatti authored Sep 13, 2019
2 parents c6b9618 + 22dd87c commit dae855c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/commands/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,15 @@ class DevCommand extends Command {

let settings = await serverSettings(Object.assign({}, config.dev, flags))

if (!(settings && settings.command)) {
this.log(`${NETLIFYDEVWARN} No dev server detected, using simple static server`)
let dist = (config.dev && config.dev.publish) || (config.build && config.build.publish)
if (flags.dir || !(settings && settings.command)) {
let dist
if (flags.dir) {
this.log(`${NETLIFYDEVWARN} Using simple static server because --dir flag was specified`)
dist = flags.dir
} else {
this.log(`${NETLIFYDEVWARN} No dev server detected, using simple static server`)
dist = (config.dev && config.dev.publish) || (config.build && config.build.publish)
}
if (!dist) {
this.log(`${NETLIFYDEVLOG} Using current working directory`)
this.log(`${NETLIFYDEVWARN} Unable to determine public folder to serve files from.`)
Expand Down

0 comments on commit dae855c

Please sign in to comment.