Skip to content

Commit 85fa913

Browse files
committed
Update Comlink import to local library to resolve CORS issues
1 parent 8e478dd commit 85fa913

File tree

5 files changed

+371
-10
lines changed

5 files changed

+371
-10
lines changed

Diff for: NOTICE.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@ FEAScript makes use of the following third-party software:
88
2. **plotly.js**
99
- License: MIT License
1010
- Source: https://github.com/plotly/plotly.js/tree/master
11-
- License: https://github.com/plotly/plotly.js/blob/master/LICENSE
11+
- License: https://github.com/plotly/plotly.js/blob/master/LICENSE
12+
13+
3. **Comlink**
14+
- License: Apache 2.0 License
15+
- Source: https://github.com/GoogleChromeLabs/comlink
16+
- License: https://github.com/GoogleChromeLabs/comlink/blob/main/LICENSE

Diff for: src/FEAWorkerScript.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
// |_| | |_ //
99
// Website: https://feascript.com/ \__| //
1010

11-
import * as Comlink from "https://unpkg.com/comlink/dist/esm/comlink.mjs";
11+
// import * as Comlink from "https://unpkg.com/comlink/dist/esm/comlink.mjs";
12+
// The Web Worker functionality now uses the local Comlink library to avoid CORS issues
13+
import * as Comlink from "./vendor/comlink.mjs";
1214
import { basicLog } from "./utilities/utilitiesScript.js";
1315

1416
export class FEAWorkerScript {

Diff for: src/FEAWrapperScript.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
// |_| | |_ //
99
// Website: https://feascript.com/ \__| //
1010

11-
import * as Comlink from "https://unpkg.com/comlink/dist/esm/comlink.mjs";
11+
// import * as Comlink from "https://unpkg.com/comlink/dist/esm/comlink.mjs";
12+
// The Web Worker functionality now uses the local Comlink library to avoid CORS issues
13+
import * as Comlink from "./vendor/comlink.mjs";
1214
import { FEAScriptModel } from "./FEAScript.js";
1315
import { create, all } from "https://cdn.jsdelivr.net/npm/mathjs@latest/+esm";
1416

Diff for: src/index.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,4 @@
1111
export { FEAScriptModel } from "./FEAScript.js";
1212
export { plotSolution } from "./visualization/plotSolutionScript.js";
1313
export { printVersion, logSystem } from "./utilities/utilitiesScript.js";
14-
15-
// Temporarily commenting out the worker export to avoid CORS issues
16-
// The Web Worker functionality relies on the Comlink library which is currently causing CORS errors:
17-
// - Error: "Loading module from 'https://unpkg.com/comlink/dist/esm/comlink.mjs' was blocked because of a disallowed MIME type ('text/html')"
18-
// - Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource"
19-
//
20-
// export { FEAWorkerScript } from "./FEAWorkerScript.js";
14+
export { FEAWorkerScript } from "./FEAWorkerScript.js";

0 commit comments

Comments
 (0)