mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 00:18:12 +08:00
Remove WebPack and let Vue CLI handle WASM. Project restructuring fixes. Add Vue SVG Loader. Fixes #29.
This commit is contained in:
+22
-25
@@ -1,30 +1,27 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
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();
|
||||
}
|
||||
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();
|
||||
|
||||
const svgRule = config.module.rule("svg");
|
||||
svgRule.uses.clear();
|
||||
svgRule
|
||||
.use("vue-loader")
|
||||
.loader("vue-loader")
|
||||
.end()
|
||||
.use("vue-svg-loader")
|
||||
.loader("vue-svg-loader");
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user