Added dot slash to the import statements in commonjs mode

This commit is contained in:
ub 2016-12-05 17:53:15 +01:00
parent 09adce0133
commit 42d37654e2
3 changed files with 4 additions and 4 deletions

View File

@ -41,7 +41,7 @@ func commonJSImports(conf *config.Config, c *code, tsFilename string) {
os.Exit(1) os.Exit(1)
} }
c.l("import * as " + importMapping.TypeScriptModule + " from '" + relativePath + "'; // " + tsFilename + " to " + importMapping.Out) c.l("import * as " + importMapping.TypeScriptModule + " from './" + relativePath + "'; // " + tsFilename + " to " + importMapping.Out)
} }
} }

View File

@ -40,7 +40,7 @@ func main() {
conf, err := config.LoadConfigFile(args[0]) conf, err := config.LoadConfigFile(args[0])
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, "config load error, could not load config from", args[0]) fmt.Fprintln(os.Stderr, "config load error, could not load config from", args[0], ":", err)
os.Exit(2) os.Exit(2)
} }
gotsrpc.Build(conf, goPath) gotsrpc.Build(conf, goPath)

View File

@ -39,7 +39,7 @@ type Config struct {
func LoadConfigFile(file string) (conf *Config, err error) { func LoadConfigFile(file string) (conf *Config, err error) {
yamlBytes, readErr := ioutil.ReadFile(file) yamlBytes, readErr := ioutil.ReadFile(file)
if readErr != nil { if readErr != nil {
err = readErr err = errors.New("could not read config file: " + readErr.Error())
return return
} }
return loadConfig(yamlBytes) return loadConfig(yamlBytes)
@ -49,7 +49,7 @@ func loadConfig(yamlBytes []byte) (conf *Config, err error) {
conf = &Config{} conf = &Config{}
yamlErr := yaml.Unmarshal(yamlBytes, conf) yamlErr := yaml.Unmarshal(yamlBytes, conf)
if yamlErr != nil { if yamlErr != nil {
err = yamlErr err = errors.New("could not parse yaml: " + yamlErr.Error())
return return
} }
switch conf.ModuleKind { switch conf.ModuleKind {