From fcecaab9a3dd88686df90bd4845b3c1090de318e Mon Sep 17 00:00:00 2001 From: Matt Edelman Date: Tue, 18 Jul 2017 07:28:31 -0700 Subject: [PATCH] make sure we can resove JSON imports without .json file extension --- lib/handlers.js | 2 ++ test/fixtures/import/child.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/handlers.js b/lib/handlers.js index 4de6aa3..31870b4 100644 --- a/lib/handlers.js +++ b/lib/handlers.js @@ -77,6 +77,8 @@ export default class Handlers { let shorty = Shortstop.create(); shorty.use('import', function (file, cb) { + //check for json extension + file = (/\.json$/.test(file)) ? file : `${file}.json`; try { file = path(file); return shorty.resolve(loadJsonicSync(file), cb); diff --git a/test/fixtures/import/child.json b/test/fixtures/import/child.json index f84f305..b270a1b 100644 --- a/test/fixtures/import/child.json +++ b/test/fixtures/import/child.json @@ -1,4 +1,4 @@ { "name": "child", - "grandchild": "import:./grandchild.json" + "grandchild": "import:./grandchild" } \ No newline at end of file