# Error "global is not defined" with agent-js

**URL:** <https://forum.dfinity.org/t/error-global-is-not-defined-with-agent-js/7509>\
**Category:** Developers\
**Created:** [September 24, 2021, 7:36am UTC](https://forum.dfinity.org/t/error-global-is-not-defined-with-agent-js/7509 "2021-09-24T07:36:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [September 24, 2021, 7:36am UTC](https://forum.dfinity.org/t/error-global-is-not-defined-with-agent-js/7509/1 "2021-09-24T07:36:59Z")

</div>

I get following error at runtime:

> Uncaught (in promise) ReferenceError: global is not defined

The errors occurs there (minimized code and see screenshot):

> RT=void 0===global.TYPED\_ARRAY\_SUPPORT||global.TYPED\_ARRAY\_SUPPORT;var \_kMaxLength=kMaxLength();f

Do I need to configure anything particular (I use Rollup) to use the library ?

P.S.: At first I thought it was an issue while upgrading from v0.9.3 to v0.10.0 but, seems actually link to something else.

 ![Capture d’écran 2021-09-24 à 09.36.29](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/7/77ea841d4383b95d2099b7bdfab58a2d68fdff58.jpeg)  
 ![Capture d’écran 2021-09-24 à 09.36.24](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/1/1919579ac0fdd053b1c9bae11f4d1152376996c2.jpeg)

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [September 24, 2021, 8:56am UTC](https://forum.dfinity.org/t/error-global-is-not-defined-with-agent-js/7509/2 "2021-09-24T08:56:44Z")

</div>

Found it! The libs need to be polyffiled but, as I move the structure of my mono-repo to npm v7 workspaces, it was not polyffied anymore because the dependencies are now centralized at the root of the repo.

Settings the path in the bundle settings solved it.

```auto
rollupPlugins: {
    after: [
      nodePolyfills({
        include: ['node_modules/ **/*.js', '../../node_modules/** /*.js']
      })
    ]
  }

```

v0.10.0 is alright once polyffied
