From b60e9279ab95030828eb4f822be96250284c4d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 1 Feb 2021 12:49:08 +0100 Subject: [PATCH] js: Fix potential path issue on Windows --- resources/resource_transformers/js/build.go | 4 ++-- resources/resource_transformers/js/options.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/resource_transformers/js/build.go b/resources/resource_transformers/js/build.go index bd126efda..bd74c98ed 100644 --- a/resources/resource_transformers/js/build.go +++ b/resources/resource_transformers/js/build.go @@ -81,8 +81,8 @@ func (t *buildTransformation) Transform(ctx *resources.ResourceTransformationCtx return err } - opts.sourcefile = ctx.SourcePath - opts.resolveDir = t.c.rs.WorkingDir + opts.sourceDir = filepath.FromSlash(path.Dir(ctx.SourcePath)) + opts.resolveDir = t.c.rs.WorkingDir // where node_modules gets resolved opts.contents = string(src) opts.mediaType = ctx.InMediaType diff --git a/resources/resource_transformers/js/options.go b/resources/resource_transformers/js/options.go index 02d8c959c..a199b2c14 100644 --- a/resources/resource_transformers/js/options.go +++ b/resources/resource_transformers/js/options.go @@ -102,7 +102,7 @@ type Options struct { mediaType media.Type outDir string contents string - sourcefile string + sourceDir string resolveDir string tsConfig string } @@ -201,7 +201,7 @@ func createBuildPlugins(c *Client, opts Options) ([]api.Plugin, error) { } relDir = filepath.Dir(rel) } else { - relDir = filepath.Dir(opts.sourcefile) + relDir = opts.sourceDir } // Imports not starting with a "." is assumed to live relative to /assets.