Skip to content

Doesn't work in basic react-app #10

Closed

Description

@BuonOmo

I've used create-react-app (which means Webpack under the hook!), and when I tried to play with this polyfill I had the following error:

Line 77:  'AbortController' is not defined  no-undef

I added some console.log in the abortcontroller script and saw nothing...

Activity

  1. mo commented on Jan 25, 2018

    @mo
    Owner

    It works but the eslint config in create-react-app creates a compile error whenever you access a global variable which is not whitelisted in the eslint "browser" environment and AbortController is so new that it is not included there yet.

    You can workaround the issue by adding "const AbortController = window.AbortController;" in each file where you use AbortController. This will not be necessary once the npm "globals" package lists AbortController in the browser environment (which will probably happen reasonably soon, one way or the other).

    I've created a boilerplate repo that shows "create-react-app + unfetch + abortcontroller-polyfill", see:
    https://github.com/mo/abortcontroller-polyfill-create-react-app-example

  2. asimmakhmudov commented on Dec 14, 2021

    @asimmakhmudov

    Thanks!

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions