Code Monkey home page Code Monkey logo

webassembly-webpack-starter-project's Introduction

WebAssembly (wasm) & Webpack starter project

Building the WebAssembly binary (wasm) is based on this tutorial. But docker containers are used to make sharing the compiler toolchain more efficiently.

prerequisite

npm i -g [email protected]
npm i -g [email protected]
npm i -g [email protected]

Get a Docker container with the compiler chain

cd ./llvm-webassembly
make pull

or

Build the Docker container with the compiler chain yourself (30min)

make build

Building the hello world wasm

cd <webassembly-webpack-starter-project>/src/cpp/
docker run --rm --name generate-wasm-default -v ${PWD}:/src  -i -t chrisber/llvm-webassembly:latest /bin/build.sh hello_world.c

or

sudo ln -s  <webassembly-webpack-starter-project>/config/d2wasm.sh /usr/local/bin/d2wasm
cd <webassembly-webpack-starter-project>/src/cpp/
d2wasm hello_world.c

webpack dev server

cd <webassembly-webpack-starter-project>/
npm i
npm run dev

project directory

├── config (Webpack build config)
│   ├── d2wasm.sh
│   ├── webpack.common.js
│   ├── webpack.dev.js
│   └── webpack.prod.js
├── dist (production build output)
├── libs
│   └── libtensorflow.so
├── llvm-webassembly
│   ├── build.sh
│   ├── Dockerfile
│   └── Makefile
├── package.json
├── Readme.md
└── src
├── cpp
│   ├── hello_world.c (entry file to build .wasm)
│   ├── hello_world.wasm
│   ├── includes
├── html
│   └── index.html (entry file html)
└── ts
├── polyfills.ts
├── index.ts (entry file to build .js)
└── vendor.ts

webassembly-webpack-starter-project's People

Contributors

chrisber avatar

Watchers

 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.