Skip to content

Commit

Permalink
Add warning for relative paths in source-filesystem. (gatsbyjs#6563)
Browse files Browse the repository at this point in the history
* Add warning for relative paths in source-filesystem.

* Fix path instead of warning.
  • Loading branch information
fabe authored and KyleAMathews committed Jul 19, 2018
1 parent 288bdc9 commit 741434e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const chokidar = require(`chokidar`)
const fs = require(`fs`)
const path = require(`path`)
const { Machine } = require(`xstate`)

const { createFileNode } = require(`./create-file-node`)
Expand Down Expand Up @@ -86,6 +87,12 @@ See docs here - https://www.gatsbyjs.org/packages/gatsby-source-filesystem/
`)
}

// Validate that the path is absolute.
// Absolute paths are required to resolve images correctly.
if (!path.isAbsolute(pluginOptions.path)) {
pluginOptions.path = path.resolve(process.cwd(), pluginOptions.path)
}

const fsMachine = createFSMachine()
let currentState = fsMachine.initialState
let fileNodeQueue = new Map()
Expand Down

0 comments on commit 741434e

Please sign in to comment.