rustwasm / create-wasm-app Goto Github PK
View Code? Open in Web Editor NEWnpm init template for consuming rustwasm pkgs
Home Page: https://www.npmjs.com/package/create-wasm-app
License: Apache License 2.0
npm init template for consuming rustwasm pkgs
Home Page: https://www.npmjs.com/package/create-wasm-app
License: Apache License 2.0
If the optional folder is more than one level deep, mkdirSync will fail. I know this is true for some node versions at least, but I have not checked the latest if the API changed (I doubt it).
One solution is use package mkdirp, another is manually splitting path string and creating a folder for each.
I mean it dependencies have updated A lot and there are many breaking changes
webpack ^4.29.3 → ^5.74.0
webpack-cli ^3.1.0 → ^4.10.0
webpack-dev-server ^3.1.5 → ^4.11.1
I guess you shouldn't have used webpack then 😝
simply use --target web I suppose.
this is intended for use with the wasm-pack tutorial, which has you write a library which then u are expected to import in the app this creates. hard to test this without actually including a library, but that is supposed to be the exercise left to the user. i think i'll publish without it for now, but we should consider whether adding an example, e.g. https://www.npmjs.com/package/@ag_dubs/hello-wasm
I have a bundle like this that is not electron-ready apparently:
const path = require('path').join(__dirname, 'my_project_bg.wasm');
const bytes = require('fs').readFileSync(path);
let imports = {};
imports['./my_project'] = require('./my_project');
const wasmModule = new WebAssembly.Module(bytes);
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
module.exports = wasmInstance.exports;
Trying to run it in Electron I get this error:
WebAssembly.Compile is disallowed on the main thread, if the buffer size is larger than 4KB. Use WebAssembly.compile, or compile on a worker thread.
Do someone used an app created with create-wasm-app in electron?
I am following along this tutorial: https://rustwasm.github.io/book/game-of-life/hello-world.html
At the "Putting it into a Webpage" step the following command fails:
$ npm init wasm-app
command not found: create-wasm-app
This is for consuming libraries made with wasm-pack
and wasm-pack-template
.
If people want one full package for creating webpages, point them to rust-webpack-template.
Maybe using yeoman?
CI should
npm init
and local packages)npm install && ./node_modules/.bin/webpack
)am I missing anything else it should do?
Going through the rustwasm book's Hello world, I was unable to generate the www
directory with the suggested command:
npm init wasm-app www
This command generates a package.json
file but not the www
directory, as in rustwasm/book#174 .
Upgrading to Node 12 seemed to solve the issue. My question is if this behavior is expected for the node version I was using (v8.10.0
) and, if so, what is the minimum version that produces the desired directory as in the the rustwasm book?
OS: Ubuntu 18.04.4.
The utility assumes git
is already installed and fails miserably if that is not the case (throws an error).
IMO, it is good to validate the respective case upfront and warn appropriately.
N/A
N/A
I'm trying to build a custom language code ditor with linting, syntax check etc.,
My opinon is to use rustwasm/web_sys crate to build and manage dom from rust. But on the initial few run Native JS dom binding seems to be performing better than rustwasm.
Do you have any performance metics comparing web_sys and native js?
I have followed the example https://rustwasm.github.io/docs/book/game-of-life/implementing.htm and modified it to use the petgraph crate and try to build a module to use wasm to store tree structure for JS.
The module compiles and seems to work following the tutorial, however if I tried to include the package locally in another project e.g. https://github.com/bbofrk/trying-wasm, or even tried publishing the package on npm (https://www.npmjs.com/package/wasm-tree-structure) then installing in into another project. I am getting the same error
WebAssembly module is included in initial chunk. friendly-errors 09:45:56
This is not allowed, because WebAssembly download and compilation must happen asynchronous.
npm install
npm run dev
Should not see compile error
WebAssembly module is included in initial chunk. friendly-errors 09:45:56
This is not allowed, because WebAssembly download and compilation must happen asynchronous.
This might have something to do with my webpack.config.js or in this case nust.config.js but I could not tell what should be included. So apologis in advance if its my personal error
The tutorial at https://rustwasm.github.io/docs/book/game-of-life/implementing.html constantly mentions to just wasm-pack build
and refresh the webpage, but does not say anything about restarting the npm run start
command after each build. Just building doesn't seem to trigger a node recompile to get the updated library into the webpage. I have to restart the node server to get it to load the new version. How can I enable the server to monitor the wasm lib too, or even the .rs files, and automatically rebuild if it detects a change?
Current version of webpack-dev-server is 3.1.5, which will trigger npm's audit. Update to version 3.1.6 or later to mute this audit.
The yarn equivalent for npm init wasm-app www
is `yarn create wasm-app www', but it doesn't work with this module.
mkdir blah
cd blah
yarn create wasm-app www
The www directory gets created like when I run npm init wasm-app www
.
Here's my output:
wt@XXXXXXX:~/projects/blah$ yarn create wasm-app www
yarn create v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
- create-wasm-app
/bin/sh: 1: /home/wt/.yarn/bin/create-wasm-app: not found
error Command failed.
Exit code: 127
Command: /home/wt/.yarn/bin/create-wasm-app
Arguments: www
Directory: /home/wt/projects/blah
Output:
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
I was following the project tutorial except that I wanted to use yarn.
Rust newbie here,
Just following the tutorial and I've reached midway through section 4.4 where I've run into a weird issue. I try building the project and running npm run start, that's when I got the error message:
ERROR in ./index.js 1:20
Module parse failed: Unexpected token (1:20)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
import { Universe } as wasm from "wasm-game-of-life";
| const pre = document.getElementById("game-of-life-canvas");
| const universe = Universe.new();
@ ./bootstrap.js 4:0-20
How would I fix this issue?
I'm trying your example integrate into my application written with using express framework but get error in browser(Firefox v.60)
"Loading failed for module with source “http://localhost:3000/public/javascripts/bootstrap.js”
html:
"
In Folder public/javascript next files unchanged as an example:
bootstrap.js
HelloWasm_bg.wasm
HelloWasm.d.ts
HelloWasm.js
index.js
WebAssembly is cool!!!Help me!
I just tried to create an instance of create-wasm-app
by executing npm init wasm-app
.
I was expecting the project initialization to succeed.
Instead, I got this error log:
~/Development/accept npm init wasm-app
npx: installed 1 in 2.048s
cloning the template failed!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.