Error "global is not defined" with agent-js

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.


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.

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

v0.10.0 is alright once polyffied

1 Like