npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

c-wasm-loader

v1.0.0-alpha.2

Published

c to wasm loader for webpack

Downloads

9

Readme

c-wasm-loader

npm

node deps tests builds coverage

Webpack loader that allows you to import C/C++ files as WebAssembly. This project is in very early development stage, and you're very welcome to contribute or file tickets, as well as it's not released yet, so api changes every day, publish process is not consistent, so some npm versions are broken.

Install with npm:

npm install --save-dev c-wasm-loader

Install with yarn:

yarn add c-wasm-loader --dev

This package automatically installs portable emsdk, so you should have cmake only available.

|Name|Type|Default|Description| |:--:|:--:|:-----:|:----------| |name|{String\|Function}|[hash].[ext]|Configure a custom filename template for your file| |regExp|{RegExp}|'undefined'|Let you extract some parts of the file path to reuse them in the name property| |outputPath|{String\|Function}|'undefined'|Configure a custom output path for your file| |useRelativePath|{Boolean}|false|Should be true if you wish to generate a context relative URL for each file| |limit|{Number\|String}|undefined|Byte limit to inline compiled files as Data URL| |std|{String}|undefined|Choose one of ISO C++ standards (C++98 / C++03, C++11, and C++14)| |includePaths|{Array}|undefined|| |bind|{Boolean}|false|| |optimizationLevel|{Number}|undefined|Optimization level for emscripten compiler| |debugLevel|{Number}|undefined|Debug level for emscripten compiler|

name

You can configure a custom filename template for your file using the query parameter name.

limit

If the file is greater than the limit (in bytes) the file-loader is used by default and all query parameters are passed to it.

The limit can be specified via loader options and defaults to no limit.

optimizationLevel

Code is optimized by specifying optimization flags when running emcc. The levels include: 0 (no optimization), 1, 2, s, z, 3.

Emcc strips out most of the debug information from optimized builds by default. Optimisation levels 0 and above remove LLVM debug information, and also disable runtime ASSERTIONS checks. From optimization level -02 the code is minified by the Closure Compiler and becomes virtually unreadable.

debugLevel

Can be used to preserve debug information in the compiled output. By default, this option preserves white-space, function names and variable names.

The flag can also be specified with one of five levels: 0, 1, 2, 3, 4. Each level builds on the last to provide progressively more debug information in the compiled output.

If set to 4 provides the most debug information — it generates source maps that allow you to view and debug the C/C++ source code in your browser’s debugger on Firefox, Chrome or Safari!

hello.c

#include <emscripten/emscripten.h>

extern "C" {
  int main(int argc, char ** argv) {
    printf("Hello\n");
  }

  int EMSCRIPTEN_KEEPALIVE world() {
    printf("World\n");
  }
}

hello.js

import hello from './hello.c';

hello().then((module) => {
  module._world();
});

webpack.config.js

module.exports = {
  externals: {
    fs: true
  },
  module: {
    rules: [
      {
        test: /\.(c|cpp)$/,
        use: {
          loader: 'c-wasm-loader',
          options: {
            outputPath: 'wasm',
            name: '[name]-[hash].[ext]'
          }
        }
      }
    ]
  }
}