I’m working on integrating the enhanced file upload feature from govuk-frontend version 5.9.0 into my Svelte 4 project. When I try to initialize the component, I keep running into an error.
Here’s my current setup:
import {onMount} from 'svelte';
import { FileUpload } from 'govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs';
import { createAll } from 'govuk-frontend/dist/govuk/init.mjs';
onMount(() => {
createAll(FileUpload);
})
// Template markup follows
The problem is I get this error message:
ReferenceError: HTMLElement is not defined at file:///myapp/node_modules/govuk-frontend/dist/govuk/component.mjs:57:25
I’m looking for a solution to this issue. Ideally I want to avoid using createAll or initAll for all components if there’s a more targeted approach. Has anyone encountered this before?