
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
emcc-loader
Advanced tools
Webpack loader that compiles some c/c++ file to bitcode and links bitcode into a wasm/asm.js using Emscripten.
Webpack loader that compiles some c/c++ files into a wasm using Emscripten.
npm install --save-dev emcc-loader
First of all, create .clist file written relative paths from the clist to c/c++ file like this:
# comment
foobar.c
# indent is also ok.
foo/bar.cpp
baz.cc
qux.cxx
# --pre-js
^pre.js
# --post-js
$post.js
Ofcourse, write c/c++ files!
#include <stdio.h>
#include <emscripten/emscripten.h>
#ifdef __cplusplus
extern "C" {
#endif
EMSCRIPTEN_KEEPALIVE
void sayHello() {
printf("hello!\n");
}
#ifdef __cplusplus
}
#endif
Next, edit your webpack.config.js:
loaders: [
{
test: /\.clist$/,
use: [
{
loader: 'emcc-loader',
options: {
buildDir: `${__dirname}/build`,
commonFlags: [ '-O2' ],
cFlags: [ '-std=c11' ],
cxxFlags: [ '-std=c++14' ],
ldFlags: [
'-s', "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall', 'cwrap']",
'-s', 'DEMANGLE_SUPPORT=1',
]
}
}
]
}
]
Now, you can import a wasm file like this:
import wasm from './module.clist';
wasm.initialize().then(module => {
module._sayHello();
});
emcc-loader is configuable on webpack.config.js.
MIT License
Inspired by cpp-wasm-loader.
FAQs
Webpack loader that compiles some c/c++ file to bitcode and links bitcode into a wasm/asm.js using Emscripten.
We found that emcc-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.