Giter Club home page Giter Club logo

assemblyscript-loader-loader's Introduction

assemblyscript-loader-loader

Loader for webpack to compile typescript with AssemblyScript and bundle it to wasm or bytes string

Install

$ yarn add assemblyscript-loader-loader --dev

Usage

webpack.config.js

{
  test: /\.tsx?$/,
  loader: 'assemblyscript-loader-loader',
  include: /assemblyscript/,
  exclude: /node_modules/,
  options: {
    limit: 1000,
    optimize: true,
    noAssert: true,
    importMemory: true,
    runtime: 'none',
    useInWorker: true,
  }
}

file.js

import asmPromise from "./assemblyscript/test.ts";
const imports = { env: {}};
asmPromise(imports).then(function(asmModule){
  // you can use the wasm exports
})

Ths usage of imports can refer to @assemblyscript/loader

Options

The loader supports some of the assemblyscript options here

custom options

Name Type Default Description
limit string | number 1000 Byte limit of the wasm file. If the size is smaller then limit value, the wasm will bundled into js, or the wasm file will build into dist.
name string [name].[hash:7].wasm Configure a custom filename template for your file.
publicPath string __webpack_public_path__ Configure a custom public path for your file.
useInWorker boolean undefined If the wasm is used in web worker, you should set useInWorker to true. Loader will set publicPath to current origin. If production mode and development mode are different, you need set publicPath at production mode.

Thanks to the authors of assemblyscript-typescript-loader and assemblyscript-wasm-loader for their contributions.

assemblyscript-loader-loader's People

Stargazers

Ruobing avatar

Watchers

James Cloos avatar obtenir avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.