mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2024-12-04 18:00:18 +00:00
Reproduce bug
This commit is contained in:
parent
9b629eef2e
commit
bb4ae8e82d
@ -27,21 +27,29 @@ type StrategyReturnType = [
|
||||
export const loadMarineDeps = async (
|
||||
CDNUrl: string,
|
||||
): Promise<StrategyReturnType> => {
|
||||
const [marineJsWasm, avmWasm] = await Promise.all([
|
||||
fetchResource(
|
||||
"@fluencelabs/marine-js",
|
||||
"/dist/marine-js.wasm",
|
||||
CDNUrl,
|
||||
).then((res) => {
|
||||
return res.arrayBuffer();
|
||||
}),
|
||||
fetchResource("@fluencelabs/avm", "/dist/avm.wasm", CDNUrl).then((res) => {
|
||||
return res.arrayBuffer();
|
||||
}),
|
||||
]);
|
||||
const timeout = new Promise((resolve) => {
|
||||
setTimeout(resolve, 500);
|
||||
});
|
||||
|
||||
// TODO: load worker in parallel with avm and marine, test that it works
|
||||
const worker = await getWorker("@fluencelabs/marine-worker", CDNUrl);
|
||||
const [marineJsWasm, avmWasm, worker] = await Promise.all([
|
||||
timeout.then(() => {
|
||||
return fetchResource(
|
||||
"@fluencelabs/marine-js",
|
||||
"/dist/marine-js.wasm",
|
||||
CDNUrl,
|
||||
).then((res) => {
|
||||
return res.arrayBuffer();
|
||||
});
|
||||
}),
|
||||
timeout.then(() => {
|
||||
return fetchResource("@fluencelabs/avm", "/dist/avm.wasm", CDNUrl).then(
|
||||
(res) => {
|
||||
return res.arrayBuffer();
|
||||
},
|
||||
);
|
||||
}),
|
||||
getWorker("@fluencelabs/marine-worker", CDNUrl),
|
||||
]);
|
||||
|
||||
return [marineJsWasm, avmWasm, worker];
|
||||
};
|
||||
|
@ -14,16 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createRequire } from "module";
|
||||
|
||||
import inject from "@rollup/plugin-inject";
|
||||
import { transform } from "esbuild";
|
||||
import { PluginOption, UserConfig } from "vite";
|
||||
import tsconfigPaths from "vite-tsconfig-paths";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const esbuildShim = require.resolve("node-stdlib-browser/helpers/esbuild/shim");
|
||||
|
||||
function minifyEs(): PluginOption {
|
||||
return {
|
||||
name: "minifyEs",
|
||||
@ -56,15 +50,6 @@ const config: UserConfig = {
|
||||
formats: ["es"],
|
||||
},
|
||||
outDir: "./dist/browser",
|
||||
rollupOptions: {
|
||||
plugins: [
|
||||
inject({
|
||||
global: [esbuildShim, "global"],
|
||||
process: [esbuildShim, "process"],
|
||||
Buffer: [esbuildShim, "Buffer"],
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
plugins: [tsconfigPaths(), minifyEs()],
|
||||
optimizeDeps: {
|
||||
|
Loading…
Reference in New Issue
Block a user