From b35832cf22d851c0e4fa9f29d4bf8855023f182a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Wed, 9 Dec 2020 14:44:56 -0500 Subject: [PATCH] fix: add all babel config files to file dependency --- src/index.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index c468f42b..07eec2a1 100644 --- a/src/index.js +++ b/src/index.js @@ -209,10 +209,19 @@ async function loader(source, inputSourceMap, overrides) { result = await transform(source, options); } - // TODO: Babel should really provide the full list of config files that - // were used so that this can also handle files loaded with 'extends'. - if (typeof config.babelrc === "string") { - this.addDependency(config.babelrc); + // Availabe since Babel 7.12 + // https://github.com/babel/babel/pull/11907 + if (config.files) { + config.files.forEach(configFile => this.addDependency(configFile)); + } else { + // .babelrc.json + if (typeof config.babelrc === "string") { + this.addDependency(config.babelrc); + } + // babel.config.js + if (config.config) { + this.addDependency(config.config); + } } if (result) {