Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something ailing with 0.0.4 version #4

Open
kikonen opened this issue Dec 13, 2015 · 1 comment
Open

Something ailing with 0.0.4 version #4

kikonen opened this issue Dec 13, 2015 · 1 comment

Comments

@kikonen
Copy link

kikonen commented Dec 13, 2015

Version 0.0.2 worked fine, but it seems that version 0.0.4 has something wrong going with module registration names.

For example,

I have module "/app/assets/javascripts/init.es6", with 0.0.2 it's registered as

System.registerModule("init", [], function() {
  "use strict";
  var __moduleName = "init";
...

But with 0.0.4 it seems to get registered as

System.registerModule("/app/assets/javascripts/init.es6", [], function() {
  "use strict";
  var __moduleName = "/app/assets/javascripts/init.es6";
...

And same for all modules. Naturally this causes that transpiled result doesn't work at all since all module references are broken.

@kikonen
Copy link
Author

kikonen commented Feb 10, 2016

Debugged this a bit and found out that there occurs some conflict with "filename" and "moduleName" options passed to traceur compiler. If both options are specified then filename is used as module name, which is of course incorrect.

Quick fix

...
module Traceur
  class Compiler
   ...
    def compile_file(infile, opts = {})
      ...
      # HACK KI filename vs. moduleName conflict
      options.filename = options.moduleName
      runner.run(
        arguments: [compile_script_path, infile.path, outfile.path, options.to_json],
        on_error: ->(r) { raise CompilationError.parse(r.stderr) }
      ).stdout
      ...
    end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant