Fix build version of the project because of web workers

This commit is contained in:
Eric NGUYEN 2022-08-17 17:47:16 +02:00
parent 2945febd91
commit c7bc77b08f
4 changed files with 4 additions and 5 deletions

View file

@ -6,7 +6,8 @@ The project is structured this way
. .
├── docs/ Documentation folder ├── docs/ Documentation folder
├── public/ Public folder in which the index.html ├── public/ Public folder in which the index.html
│ import its resources │ │ import its resources
│ └── workers/ Webworkers folder
├── src/ Source folder for the react app ├── src/ Source folder for the react app
│ ├── assets/ Assets folder in which the react app │ ├── assets/ Assets folder in which the react app
│ │ import its resources │ │ import its resources
@ -17,7 +18,6 @@ The project is structured this way
│ ├── test/ Setup folder for the tests │ ├── test/ Setup folder for the tests
│ ├── tests/ Other tests + resources │ ├── tests/ Other tests + resources
│ ├── utils/ Utilities folder │ ├── utils/ Utilities folder
│ ├── workers/ Webworkers folder
│ ├── index.scss Tailwind CSS extends │ ├── index.scss Tailwind CSS extends
│ ├── main.tsx Entrypoint for App injection │ ├── main.tsx Entrypoint for App injection
│ └── vite-env.d.ts Types for .env files │ └── vite-env.d.ts Types for .env files

View file

@ -3,7 +3,6 @@ import { IConfiguration } from '../../Interfaces/IConfiguration';
import { getCircularReplacer } from '../../utils/saveload'; import { getCircularReplacer } from '../../utils/saveload';
import { ID } from '../SVG/SVG'; import { ID } from '../SVG/SVG';
import { IEditorState } from '../../Interfaces/IEditorState'; import { IEditorState } from '../../Interfaces/IEditorState';
import Worker from '../../workers/worker?worker';
export function SaveEditorAsJSON( export function SaveEditorAsJSON(
history: IHistoryState[], history: IHistoryState[],
@ -21,7 +20,7 @@ export function SaveEditorAsJSON(
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (window.Worker) { if (window.Worker) {
// use webworker for the stringify to avoid freezing // use webworker for the stringify to avoid freezing
const myWorker = new Worker(); const myWorker = new Worker('workers/worker.js');
myWorker.postMessage({ editorState, spaces }); myWorker.postMessage({ editorState, spaces });
myWorker.onmessage = (event) => { myWorker.onmessage = (event) => {
const data = event.data; const data = event.data;

View file

@ -16,7 +16,7 @@
"noEmit": true, "noEmit": true,
"jsx": "react-jsx" "jsx": "react-jsx"
}, },
"include": ["src", "src/workers"], "include": ["src"],
"exclude": ["test-server"], "exclude": ["test-server"],
"references": [{ "path": "./tsconfig.node.json" }] "references": [{ "path": "./tsconfig.node.json" }]
} }