Skip to content

Commit

Permalink
fix(dcellar-web-ui): worker assetprefix
Browse files Browse the repository at this point in the history
  • Loading branch information
aiden-cao committed Nov 17, 2023
1 parent 829771d commit baf9d69
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/dcellar-web-ui/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const nextConfig = {
reactStrictMode: false,
distDir: '.next',
webpack,
assetPrefix,
assetPrefix: process.env.NODE_ENV === 'production' ? '/static/dcellar-web-ui' : '',
pageExtensions: ['mdx', 'jsx', 'js', 'ts', 'tsx'],
generateBuildId: async () => {
return commitHash;
Expand Down
2 changes: 1 addition & 1 deletion apps/dcellar-web-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@reduxjs/toolkit": "^1.9.5",
"react-redux": "^8.1.1",
"next-redux-wrapper": "^8.1.0",
"redux-persist": "^6.0.0",
"redux-persist": "^6.0.0",
"@wagmi/core": "^0.10.13",
"fast-xml-parser": "~4.2.7",
"swiper": "~10.3.1",
Expand Down
6 changes: 3 additions & 3 deletions apps/dcellar-web-ui/src/modules/checksum/calcSecondWorker.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { sha256 } from 'hash-wasm';
import { decodeBase64 } from '@/utils/coder';

const assetPrefix = process.env.NEXT_PUBLIC_STATIC_HOST || '';
globalThis.importScripts(`${assetPrefix}/wasm/wasm_exec.js`);
const isProd = process.env.NODE_ENV === 'production';
globalThis.importScripts(`${isProd ? '/static/dcellar-web-ui' : ''}/wasm/wasm_exec.js`);

declare global {
const Go: new () => { run: (x: WebAssembly.Instance) => void; importObject: WebAssembly.Imports };
Expand All @@ -15,7 +15,7 @@ declare global {
const init = async () => {
const go = new Go();
const result = await WebAssembly.instantiateStreaming(
fetch(`${assetPrefix}/wasm/main.wasm`),
fetch(`${isProd ? '/static/dcellar-web-ui' : ''}/wasm/main.wasm`),
go.importObject,
);
if (result) {
Expand Down

0 comments on commit baf9d69

Please sign in to comment.