Skip to content

Commit

Permalink
revert back to using compiler worker, otherwise ndoejs fail
Browse files Browse the repository at this point in the history
  • Loading branch information
hiukim committed Dec 14, 2022
1 parent f3dd5f0 commit 9f22aa4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/image-target/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as msgpack from '@msgpack/msgpack';
import * as tf from '@tensorflow/tfjs';
import { createCanvas } from 'canvas'
import { extract } from './tracker/extract.js';
import CompilerWorker from "./compiler.worker.js?worker&inline";
//import CompilerWorker from "./compiler.worker.js?worker&inline";

// TODO: better compression method. now grey image saved in pixels, which could be larger than original image

Expand Down Expand Up @@ -84,8 +84,8 @@ class Compiler {
}
resolve(list);
} else {
//const worker = new Worker(new URL('./compiler.worker.js', import.meta.url));
const worker = new CompilerWorker();
const worker = new Worker(new URL('./compiler.worker.js', import.meta.url));
//const worker = new CompilerWorker();
worker.onmessage = (e) => {
if (e.data.type === 'progress') {
progressCallback(50 + e.data.percent);
Expand Down
3 changes: 2 additions & 1 deletion vite.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const outDir = 'dist-dev'
const moduleConfig={
mode: 'development',
assetsInclude:'**/*.html',
base:'./',
plugins:[],
build: {
outDir: outDir,
Expand Down Expand Up @@ -91,4 +92,4 @@ export default defineConfig(async ({ command, mode }) => {
}));
}
return moduleConfig
})
})
3 changes: 2 additions & 1 deletion vite.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const outDir = 'dist'
const moduleConfig= defineConfig({
mode: 'production',
publicDir:false,
base:'./',
build: {
outDir:outDir,
emptyOutDir:false,
Expand Down Expand Up @@ -89,4 +90,4 @@ export default defineConfig(async ({ command, mode }) => {
}));
}
return moduleConfig
})
})

0 comments on commit 9f22aa4

Please sign in to comment.