From a387663186633d8439fe564411eab1c5689d17ee Mon Sep 17 00:00:00 2001 From: Benjamin Stepp Date: Sun, 22 May 2016 15:52:21 -0500 Subject: [PATCH] Use resolve.root over resolve.modulesDirectories This is a performance optimization recommended in #280 --- `gatsby-starter-blog` Before: ``` Command being timed: "gatsby build" User time (seconds): 25.29 System time (seconds): 2.47 Percent of CPU this job got: 106% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:26.17 ``` After: ``` Command being timed: "gatsby build" User time (seconds): 24.29 System time (seconds): 2.83 Percent of CPU this job got: 110% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:24.56 ``` --- `kyleamathews/blog` Before: ``` Command being timed: "gatsby build" User time (seconds): 32.10 System time (seconds): 2.57 Percent of CPU this job got: 107% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:32.31 ``` After: ``` Command being timed: "gatsby build" User time (seconds): 29.84 System time (seconds): 2.81 Percent of CPU this job got: 110% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:29.59 ``` --- lib/utils/webpack.config.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/utils/webpack.config.js b/lib/utils/webpack.config.js index 8430a7f0629ce..91fd2f9a168ec 100644 --- a/lib/utils/webpack.config.js +++ b/lib/utils/webpack.config.js @@ -154,11 +154,9 @@ module.exports = (program, directory, stage, webpackPort = 1500, routes = []) => '.toml', '.yaml', ], - modulesDirectories: [ + root: [ directory, - `${__dirname}/../isomorphic`, - `${directory}/node_modules`, - 'node_modules', + path.resolve(__dirname, '..', 'isomorphic'), ], } }