From 3d349863b1fbefef7479914fe1558f2711dd713a Mon Sep 17 00:00:00 2001 From: Fumiaki MATSUSHIMA Date: Sat, 22 Sep 2018 12:09:38 +0900 Subject: [PATCH] Return fileName to have sass-loader handle dependency correctly --- CHANGELOG.md | 4 ++++ src/index.js | 1 + test/index.js | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8d12df..3ade105 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 4.1.0 + +- Return `fileName` to have sass-loader handle dependency correctly (#74). + ## 4.0.1 * Update package.json's main field (#73). diff --git a/src/index.js b/src/index.js index d7e65f9..41e9460 100644 --- a/src/index.js +++ b/src/index.js @@ -36,6 +36,7 @@ export default function(options = {}) { return { contents: transformJSONtoSass(json), + file: fileName, }; } catch(error) { return new Error(`node-sass-json-importer: Error transforming JSON/JSON5 to SASS. Check if your JSON/JSON5 parses correctly. ${error}`); diff --git a/test/index.js b/test/index.js index 4ec0677..36064c9 100644 --- a/test/index.js +++ b/test/index.js @@ -20,6 +20,10 @@ describe('node-sass-json-importer', function() { }); expect(result.css.toString()).to.eql(EXPECTATION); + expect(result.stats.includedFiles).to.eql([ + resolve('./test/fixtures/strings/style.scss'), + resolve('./test/fixtures/strings/variables.json'), + ].sort()); }); // TODO: Added to verify named exports + CommonJS default export hack (see index.js).