Skip to content

Vite/ESM import for protected-eval #25

Description

@bjunix

Hi :)

When using version 2.0.0 in a Vite/TypeScript project, the documented usage:

import ProtectedEval from "@formio/protected-eval";

Formio.use(ProtectedEval);

does not work because the imported value is exposed as:

{
  default: {
    evaluator: ...
  }
}

We currently need to unwrap it before registration:

const protectedEval = (
  ProtectedEval as unknown as { default: typeof ProtectedEval }
).default;

Formio.use(protectedEval);

Is this the recommended way to use the Protected Eval plugin in Vite projects, or would it be possible to provide an ESM-compatible export/build in a future release?

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions