mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-23 03:28:11 +08:00
Add WASM bindings and web project structure
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
dist/
|
||||
pkg/
|
||||
@@ -0,0 +1,5 @@
|
||||
const wasm = import("./pkg");
|
||||
|
||||
wasm
|
||||
.then(wasm => wasm.greet())
|
||||
.catch(console.error);
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "graphite-web-frontend",
|
||||
"version": "0.1.0",
|
||||
"description": "Graphite's web app frontend pathfinder. Planned to be replaced by a Rust native GUI framework in the future.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"start": "webpack serve"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/keavon/graphite.git"
|
||||
},
|
||||
"author": "Keavon Chambers <graphite@keavon.com>",
|
||||
"license": "Apache-2.0",
|
||||
"homepage": "https://www.graphite.design",
|
||||
"devDependencies": {
|
||||
"@wasm-tool/wasm-pack-plugin": "^1.3.3",
|
||||
"html-webpack-plugin": "^5.1.0",
|
||||
"webpack": "^5.21.2",
|
||||
"webpack-cli": "^4.5.0",
|
||||
"webpack-dev-server": "^3.11.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
||||
|
||||
module.exports = {
|
||||
entry: "./main.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "main.js",
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({ title: 'Graphite' }),
|
||||
new WasmPackPlugin({
|
||||
crateDirectory: path.resolve(__dirname, "..", "packages", "wasm-bindings"),
|
||||
outDir: path.resolve(__dirname, "pkg"),
|
||||
}),
|
||||
],
|
||||
mode: "development",
|
||||
devtool: 'source-map',
|
||||
experiments: {
|
||||
syncWebAssembly: true,
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user