1

I keep getting below error in my react app. Not sure what is the issue.

/Users/823222/miniapp/node_modules/headers-polyfill/lib/Headers.js 9:25 Module parse failed: Unexpected token (9:25) File was processed with these loaders:

  • ../../node_modules/source-map-loader/index.js You may need an additional loader to handle the result of these loaders. | class HeadersPolyfill { | // Normalized header {"name":"a, b"} storage.
[NORMALIZED_HEADERS] = {};

| // Keeps the mapping between the raw header name | // and the normalized header name to ease the lookup.

1
  • 1
    You're using array destructuring syntax on an object. That's a syntax error. Commented Jul 9, 2022 at 16:24

1 Answer 1

1

Looks like this is due to a recent change in this package, that changed how the symbols were declared:

https://github.com/mswjs/headers-polyfill/pull/33/files

I've started a GitHub issue here, feel free to add details about your environment: https://github.com/mswjs/headers-polyfill/issues/36

TL;DR: There was a significant change to how the module is prepared in a recent release, I reverted to 3.0.4 and things are working again for me.

Edit: 3.0.10 released that reverts the build target and fixes this issue: https://github.com/mswjs/headers-polyfill/releases/tag/v3.0.10

Sign up to request clarification or add additional context in comments.

1 Comment

Yep. Using the latest version of the "headers-polyfill" should be enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.