Skip to content

Commit b60e927

Browse files
committed
js: Fix potential path issue on Windows
1 parent a9b0fea commit b60e927

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

resources/resource_transformers/js/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ func (t *buildTransformation) Transform(ctx *resources.ResourceTransformationCtx
8181
return err
8282
}
8383

84-
opts.sourcefile = ctx.SourcePath
85-
opts.resolveDir = t.c.rs.WorkingDir
84+
opts.sourceDir = filepath.FromSlash(path.Dir(ctx.SourcePath))
85+
opts.resolveDir = t.c.rs.WorkingDir // where node_modules gets resolved
8686
opts.contents = string(src)
8787
opts.mediaType = ctx.InMediaType
8888

resources/resource_transformers/js/options.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ type Options struct {
102102
mediaType media.Type
103103
outDir string
104104
contents string
105-
sourcefile string
105+
sourceDir string
106106
resolveDir string
107107
tsConfig string
108108
}
@@ -201,7 +201,7 @@ func createBuildPlugins(c *Client, opts Options) ([]api.Plugin, error) {
201201
}
202202
relDir = filepath.Dir(rel)
203203
} else {
204-
relDir = filepath.Dir(opts.sourcefile)
204+
relDir = opts.sourceDir
205205
}
206206

207207
// Imports not starting with a "." is assumed to live relative to /assets.

0 commit comments

Comments
 (0)