Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebPack 5.83.1 TypeError #3697

Closed
abhi-markan opened this issue May 22, 2023 · 4 comments
Closed

WebPack 5.83.1 TypeError #3697

abhi-markan opened this issue May 22, 2023 · 4 comments

Comments

@abhi-markan
Copy link
Contributor

What

Upon webpack compilation for webpack 5.80.1 or above a type error pertaining to character count component is being thrown at console thus causing tests to fail.

Why

Webpack compilation
image

Anything else

    "webpack": "^5.83.1",
    "webpack-cli": "^5.1.1",
    "webpack-merge": "^5.9.0"
@owenatgov
Copy link
Contributor

Transferring this issue to the govuk-frontend repo

@owenatgov owenatgov transferred this issue from alphagov/govuk-design-system-backlog May 26, 2023
@owenatgov
Copy link
Contributor

Hi @abhi-markan. thanks for raising this. Could you please provide code for your implementation of the character count component?

@colinrotherham
Copy link
Contributor

@owenatgov I've set up a webpack-character-count branch and it's running without errors

It's branched from v4.6.0 but can still be run with:

npm run dev --workspace govuk-frontend-webpack-boilerplate

I've swapped our basic "Button" example for "Character count" with the HTML from here:
https://design-system.service.gov.uk/components/character-count/default/index.html

Would be good to check the HTML the JS crashes on, with it likely being .govuk-character-count__message

<div id="with-hint-info" class="govuk-hint govuk-character-count__message">
  You can enter up to 200 characters
</div>

You can see the HTML snippet I've used in ./docs/examples/webpack/src/index.html

@colinrotherham
Copy link
Contributor

I'm going to close this one since we'll soon log errors for missing elements in GOV.UK Frontend v5.0.0

Seems like Character Count changes in #4261 would catch the missing element before we call .insertAdjacentElement() so the error in the screenshot wouldn't happen:

Uncaught TypeError: Failed to execute insertAdjacentElement' on 'Element': parameter 2 is not of type "Element'

You'd see our friendly error instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants