Currently, I am utilizing a Web Worker for performing calculations on a GeoTiff file. The function getRidgePoints
from CalculateRidge.ts
is invoked, where this function initiates a worker, sends a message to the worker, waits for a result from the worker, terminates the worker upon receiving the result, and finally returns the result. The usage of Comlink was considered, but the current approach with wrapping the worker in an "await" function has proven to work effectively.
The worker includes an addEventListener
that triggers the execution of the function
CreateRidge_Init</code, which handles the necessary calculations. This function involves loading a GeoTiff file, reading it, and conducting calculations based on the extracted values.</p>
<p>However, there seems to be an issue:</p>
<p>While attempting to build the code, an error occurs as follows:</p>
<pre><code>Error [RollupError]: Invalid value "iife" for option "output.format" - UMD and IIFE output formats are not supported for code-splitting builds.
at error (file:///C:/Users/ono/Documents/Programmering/solar-analysis-faroe-island/node_modules/rollup/dist/es/shared/node-entry.js:2125:30)
. . .
Further investigation revealed that incorporating both GeoTiff.js methods (fromArrayBuffer()
and .getImage()
) alongside a Web Worker triggers this error:
- Executing
CreateRidge_Init
directly on the main thread bypasses the Web Worker and allows successful building. - Omitting the use of
fromArrayBuffer()
and.getImage()
within the Web Worker also facilitates successful building.
Despite experimenting with different build.rollupOptions settings, no changes were observed in the error during the build process. Notably, the code operates perfectly in development environments.
For reference, here are snippets from the key files involved:
import workerUrl from "src/lib/Functions/CalculateRidgeWorker?worker&url";
. . .
To address the underlying problem, adjustments may need to be made in the rollupOptions configuration to resolve the build error encountered.