mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 12:08:11 +08:00
Add wasm-bindgen to Vue config (#38)
This commit is contained in:
committed by
Keavon Chambers
parent
21dca857cd
commit
8741e31c92
@@ -26,7 +26,7 @@
|
|||||||
"@vue/compiler-sfc": "^3.0.7",
|
"@vue/compiler-sfc": "^3.0.7",
|
||||||
"@vue/eslint-config-airbnb": "^5.0.2",
|
"@vue/eslint-config-airbnb": "^5.0.2",
|
||||||
"@vue/eslint-config-typescript": "^5.0.2",
|
"@vue/eslint-config-typescript": "^5.0.2",
|
||||||
"@wasm-tool/wasm-pack-plugin": "^1.3.3",
|
"@wasm-tool/wasm-pack-plugin": "github:wasm-tool/wasm-pack-plugin",
|
||||||
"eslint": "^6.7.2",
|
"eslint": "^6.7.2",
|
||||||
"eslint-plugin-import": "^2.20.2",
|
"eslint-plugin-import": "^2.20.2",
|
||||||
"eslint-plugin-vue": "^7.8.0",
|
"eslint-plugin-vue": "^7.8.0",
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
||||||
|
const webpack = require("webpack");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
chainWebpack: config => {
|
||||||
|
// rust wasm bindgen https://github.com/rustwasm/wasm-bindgen
|
||||||
|
config
|
||||||
|
.plugin("wasm-pack")
|
||||||
|
.use(WasmPackPlugin)
|
||||||
|
.init(
|
||||||
|
Plugin =>
|
||||||
|
new Plugin({
|
||||||
|
crateDirectory: path.resolve(__dirname, "wasm")
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.end()
|
||||||
|
// needed for Edge browser https://rustwasm.github.io/docs/wasm-bindgen/examples/hello-world.html
|
||||||
|
.plugin("text-encoder")
|
||||||
|
.use(webpack.ProvidePlugin)
|
||||||
|
.init(
|
||||||
|
Plugin =>
|
||||||
|
new Plugin({
|
||||||
|
TextDecoder: ["text-encoding", "TextDecoder"],
|
||||||
|
TextEncoder: ["text-encoding", "TextEncoder"]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.end();
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -11,7 +11,7 @@ module.exports = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
new HtmlWebpackPlugin({ title: "Graphite" }),
|
new HtmlWebpackPlugin({ title: "Graphite" }),
|
||||||
new WasmPackPlugin({
|
new WasmPackPlugin({
|
||||||
crateDirectory: path.resolve(__dirname, "..", "packages", "wasm-bindings"),
|
crateDirectory: path.resolve(__dirname, "wasm"),
|
||||||
outDir: path.resolve(__dirname, "pkg"),
|
outDir: path.resolve(__dirname, "pkg"),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user