title: How can I generate code to export functions for node in Dart?
body: <p>(I failed at getting this working in dart2js so I'm trying in dart dev compiler; but I'd happily take an answer for dart2j!).</p>
  
  <p>If I have <code>test.dart</code>:</p>
  
  <pre><code>void activate() {
    print("activating...");
  }
  </code></pre>
  
  <p>and run <code>dartdevc --modules node -o test.js test.dart</code> the output is:</p>
  
  <pre><code>(function() {
    'use strict';
    const dart_sdk = require('dart_sdk');
    const core = dart_sdk.core;
    const dart = dart_sdk.dart;
    const dartx = dart_sdk.dartx;
    const __test = Object.create(null);
    let VoidTovoid = () =&gt; (VoidTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
    __test.activate = function() {
      core.print("activating...");
    };
    dart.fn(__test.activate, VoidTovoid());
    // Exports:
    exports.__test = __test;
  })();
  </code></pre>
  
  <p>This means my function is exported as <code>__test.activate</code> but what I need is for it just to be <code>activate</code>.</p>
  
  <p>How can I control this? The JS I'm aiming for the equivilent of this:</p>
  
  <pre><code>exports.activate = function() { core.print("activating"); }
  </code></pre>