Files
Graphite/website/other/bezier-rs-demos/vue.config.js
T
Hannah Li f74b6ed111 Refactor bezier-rs' to_svg functionality (#758)
* Change Bezier to_svg to include handles and endpoints

* Move params into brackets of format macro, remove unused comment

* Use write macro instead of format

* Fix path for watched directory

* Refactor functions to remove ToSVGOptions
2022-09-01 23:13:39 -04:00

37 lines
1.2 KiB
JavaScript

const path = require("path");
const { defineConfig } = require("@vue/cli-service");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
module.exports = defineConfig({
publicPath: ".",
transpileDependencies: true,
// https://cli.vuejs.org/guide/webpack.html
chainWebpack: (config) => {
// WASM Pack Plugin integrates compiled Rust code (.wasm) and generated wasm-bindgen code (.js) with the webpack bundle
// Use this JS to import the bundled Rust entry points: const wasm = import("@/../wasm/pkg").then(panicProxy);
// Then call WASM functions with: (await wasm).function_name()
// https://github.com/wasm-tool/wasm-pack-plugin
config
// https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-plugin
.plugin("wasm-pack")
.use(WasmPackPlugin)
.init(
(Plugin) =>
new Plugin({
crateDirectory: path.resolve(__dirname, "wasm"),
// Remove when this issue is resolved: https://github.com/wasm-tool/wasm-pack-plugin/issues/93
outDir: path.resolve(__dirname, "wasm/pkg"),
watchDirectories: ["../../../libraries/bezier-rs"].map((folder) => path.resolve(__dirname, folder)),
})
)
.end();
},
configureWebpack: {
experiments: {
asyncWebAssembly: true,
},
},
});