mattjohnruss / emscripten

Emscripten loader for Webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@wasm-tool/emscripten

Emscripten loader for Webpack

Attention: loader is an experimentation.

Installation

npm i -D @wasm-tool/emscripten

Usage

Add the loader and mock the fs module in your Webpack configuration:

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /\.c$/,
        loader: "@wasm-tool/emscripten"
      }
    ]
  },
  node: {
    fs: "empty"
  },
  // ...
};

You can then directly import c files:

import("./add.c").then(exports => ...);

emcc must be available in your $PATH, see http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html.

About

Emscripten loader for Webpack

License:MIT License


Languages

Language:JavaScript 95.5%Language:C 4.5%