1.1.0 • Published 4 years ago

assemblyscript-loader-loader v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

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

NameTypeDefaultDescription
limitstring \| number1000Byte 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.
namestring[name].[hash:7].wasmConfigure a custom filename template for your file.
publicPathstring__webpack_public_path__Configure a custom public path for your file.
useInWorkerbooleanundefinedIf 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.

1.1.0

4 years ago

1.0.0

4 years ago

0.1.2

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.5

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago