Skip to content

Commit

Permalink
js: Fix potential path issue on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Feb 16, 2021
1 parent a9b0fea commit b60e927
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions resources/resource_transformers/js/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions resources/resource_transformers/js/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type Options struct {
mediaType media.Type
outDir string
contents string
sourcefile string
sourceDir string
resolveDir string
tsConfig string
}
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit b60e927

Please sign in to comment.