Production error Electron and cornerstone3d

Hi all

I’m building an application with electron and cornerstone3d.
At the moment everything is going well, and I can show DICOM images in the application in debug mode, running the project with VITE 4.
But when doing the production build, and running the application as an executable file in Linux or Windows, I am receiving errors that make the window appear completely blank, and only 2 lines appear in the error console.

The first line, less suspicious because it was already there before incorporating cornerstone3d

The Content-Security-Policy directive name ‘*’ contains one or more invalid characters. Only ASCII alphanumeric characters or dashes ‘-’ are allowed in directive names.

The second line, this new one error, is the next one.

index-2d0928b3.js:141723 Uncaught ReferenceError: Cannot access ‘annotationState’ before initialization at index-2d0928b3.js:141723:10

The code it refers to is the following.

const index$y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  AnnotationGroup,
  FrameOfReferenceSpecificAnnotationManager: FrameOfReferenceSpecificAnnotationManager$1,
  config: index$z,
  locking: annotationLocking,
  selection: annotationSelection,
// Error location is the next line: Uncaught ReferenceError: Cannot access 'annotationState' before initialization
  state: annotationState,
///////
  visibility: annotationVisibility
}, Symbol.toStringTag, { value: "Module" }));
function getInterpolationData(viewportData, filterParams = []) {
  const { viewport, sliceData, annotation } = viewportData;
  const interpolationDatas = /* @__PURE__ */ new Map();
  const annotations = getAnnotations(annotation.metadata.toolName, viewport.element);
  for (let i2 = 0; i2 < sliceData.numberOfSlices; i2++) {
    const imageAnnotations = annotations.filter((x) => x.metadata.referencedSliceIndex === i2);
    if (!imageAnnotations?.length) {
      continue;
    }
    const filteredInterpolatedAnnotations = imageAnnotations.filter((imageAnnotation) => {
      return filterParams.every((x) => {
        const parent = x.parentKey ? x.parentKey(imageAnnotation) : imageAnnotation;
        const value = parent?.[x.key];
        if (Array.isArray(value)) {
          return value.every((item, index2) => item === x.value[index2]);
        }
        return value === x.value;
      });
    });
    interpolationDatas.set(i2, filteredInterpolatedAnnotations);
  }
  return interpolationDatas;
}

I am totally lost as to what could be happening since the information about the error is minimal. And I don’t find any connection with a possible solution.

Could someone give me some clue as to what might be happening, since I’m not familiar with the cornerstone3d code.

Thank you very much