mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 09:27:19 +08:00
18 lines
620 B
JavaScript
18 lines
620 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.wasmPlugin = void 0;
|
|
const utils_1 = require("../utils");
|
|
exports.wasmPlugin = ({ app }) => {
|
|
app.use((ctx, next) => {
|
|
if (ctx.path.endsWith('.wasm') && utils_1.isImportRequest(ctx)) {
|
|
ctx.type = 'js';
|
|
ctx.body = `export default (opts = {}) => {
|
|
return WebAssembly.instantiateStreaming(fetch(${JSON.stringify(ctx.path)}), opts)
|
|
.then(obj => obj.instance.exports)
|
|
}`;
|
|
return;
|
|
}
|
|
return next();
|
|
});
|
|
};
|
|
//# sourceMappingURL=serverPluginWasm.js.map
|