summaryrefslogtreecommitdiffstats
path: root/resources/resource_transformers/babel
diff options
context:
space:
mode:
authorAndreas Deininger <andreas@deininger.net>2023-05-22 18:14:10 +0200
committerGitHub <noreply@github.com>2023-05-22 18:14:10 +0200
commit9a0370e8eb71fed3ac04984020b6aa95c43f22ab (patch)
tree031150a69c18dc216321e716abcb506e10616428 /resources/resource_transformers/babel
parent10d0fcc01f77b1edad16fbdd415825731f7419fb (diff)
postcss: Improve validation of option 'config'
Diffstat (limited to 'resources/resource_transformers/babel')
-rw-r--r--resources/resource_transformers/babel/babel.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/resources/resource_transformers/babel/babel.go b/resources/resource_transformers/babel/babel.go
index ff19d9dda..5ed09d200 100644
--- a/resources/resource_transformers/babel/babel.go
+++ b/resources/resource_transformers/babel/babel.go
@@ -134,13 +134,17 @@ func (t *babelTransformation) Transform(ctx *resources.ResourceTransformationCtx
}
configFile = filepath.Clean(configFile)
+ isConfigFileDir := false
// We need an absolute filename to the config file.
if !filepath.IsAbs(configFile) {
- configFile = t.rs.BaseFs.ResolveJSConfigFile(configFile)
+ configFile, isConfigFileDir = t.rs.BaseFs.ResolveJSConfigFile(configFile)
+ if isConfigFileDir {
+ logger.Warnf("babel config %q must be a file, not a directory", configFile)
+ }
if configFile == "" && t.options.Config != "" {
// Only fail if the user specified config file is not found.
- return fmt.Errorf("babel config %q not found:", configFile)
+ return fmt.Errorf("babel config file %q not found", configFile)
}
}