Skip to content

Compile to JavaScript #838

Closed
Closed
@MichaelJCole

Description

@MichaelJCole

Using the starter project, at webassembly.studio, I can compile an AssemblyScript.ts file to wasm.

Question: How can I compile AssemblyScript.ts to JavaScript?

This is what I have so far:

gulp.task("build-wasm", callback => {
  const asc = require("assemblyscript/bin/asc");
  asc.main([
    "nBodyForces.ts",
    "--baseDir", "assembly",
    "--binaryFile", "../out/nBodyForces.wasm",
    "--sourceMap",
    "--measure",
    "--runtime", "half",
    "--optimize"
  ], callback);
});

gulp.task('build-js', function () {
  const tsProject = ts.createProject('assembly/tsconfig.json', {
    outFile: 'nBodyForces.js'
  });

  return tsProject.src()
      .pipe(tsProject())
      .pipe(gulp.dest('out'));
});


gulp.task("default", ["build-wasm", "build-js"]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions