Global is not defined

Hi,

Is there anyone who can help me with debugging this weird error?

ReferenceError: global is not defined
    at eval (webpack://__ember_auto_import__/./node_modules/has-symbols/index.js?:3:18)
    at Object../node_modules/has-symbols/index.js (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:158517:1)
    at __webpack_require__ (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156151:30)
    at eval (webpack://__ember_auto_import__/./node_modules/es-abstract/GetIntrinsic.js?:39:18)
    at Object../node_modules/es-abstract/GetIntrinsic.js (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:158089:1)
    at __webpack_require__ (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156151:30)
    at eval (webpack://__ember_auto_import__/./node_modules/es-abstract/2019/ToString.js?:3:20)
    at Object../node_modules/es-abstract/2019/ToString.js (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:158053:1)
    at __webpack_require__ (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156151:30)
    at eval (webpack://__ember_auto_import__/./node_modules/@formatjs/ecma402-abstract/lib/src/polyfill-utils.js?:23:83)
    at Module../node_modules/@formatjs/ecma402-abstract/lib/src/polyfill-utils.js (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156425:1)
    at __webpack_require__ (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156151:30)
    at eval (webpack://__ember_auto_import__/./node_modules/@formatjs/ecma402-abstract/lib/index.js?:2:77)
    at Module../node_modules/@formatjs/ecma402-abstract/lib/index.js (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156357:1)
    at __webpack_require__ (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156151:30)
    at eval (webpack://__ember_auto_import__/./node_modules/@formatjs/intl-relativetimeformat/index.js?:13:26)
    at Object../node_modules/@formatjs/intl-relativetimeformat/index.js (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156731:1)
    at __webpack_require__ (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156151:30)
    at eval (webpack://__ember_auto_import__/./node_modules/@formatjs/intl-relativetimeformat/polyfill.js?:13:26)
    at Object../node_modules/@formatjs/intl-relativetimeformat/polyfill.js (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156765:1)
    at __webpack_require__ (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor.js:156151:30)
    at Module.eval [as callback] (webpack://__ember_auto_import__//tmp/broccoli-1060405OczT82cgzH5/cache-606-bundler/staging/app.js?:22:77)
    at Module.exports (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor/loader/loader.js:106:1)
    at Module._reify (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor/loader/loader.js:143:1)
    at Module.reify (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor/loader/loader.js:130:1)
    at Module.exports (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor/loader/loader.js:104:1)
    at Module._reify (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor/loader/loader.js:143:1)
    at Module.reify (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor/loader/loader.js:130:1)
    at Module.exports (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor/loader/loader.js:104:1)
    at Object.requireModule (/tmp/broccoli-1060405OczT82cgzH5/out-607-append_ember_auto_import_analyzer/assets/vendor/loader/loader.js:27:1)
    at Object.<anonymous> (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/fastboot/src/ember-app.js:213:18)
    at VMSandbox.run (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/fastboot/src/vm-sandbox.js:18:15)
    at EmberApp.createEmberApp (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/fastboot/src/ember-app.js:212:30)
    at EmberApp.retrieveSandboxedApp (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/fastboot/src/ember-app.js:237:17)
    at new EmberApp (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/fastboot/src/ember-app.js:61:21)
    at FastBoot._buildEmberApp (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/fastboot/src/index.js:114:17)
    at new FastBoot (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/fastboot/src/index.js:52:10)
    at /home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/ember-cli-fastboot/index.js:335:29
    at Layer.handle [as handle_request] (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/express/lib/router/index.js:317:13)
    at /home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/express/lib/router/index.js:335:12)
    at next (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/express/lib/router/index.js:275:10)
    at /home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/ember-cli/lib/tasks/server/middleware/broccoli-watcher/index.js:54:11
    at watcher.then.errorHandler.buildError (/home/gedaiu/workspace/gis-collective/frontend/web-frontend/node_modules/broccoli-middleware/lib/watcher-middleware.js:35:7)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
cleaning up...

It looks like you’re trying to use a library (has-symbols) via ember-auto-import that uses Node-only features. It won’t work in the browser unless you do something to polyfill those features. See GitHub - ef4/ember-auto-import: Zero config import from npm packages

It looks like I have this error because of intl-numberformat I guess I should open an issue to this project.

yarn why v1.22.4
[1/4] Why do we have the module "has-symbols"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "has-symbols@1.0.1"
info Reasons this module exists
   - "@formatjs#intl-numberformat#es-abstract" depends on it
   - Hoisted from "@formatjs#intl-numberformat#es-abstract#has-symbols"
   - Hoisted from "@ember#optional-features#util.promisify#has-symbols"
   - Hoisted from "@formatjs#intl-numberformat#es-abstract#object.assign#has-symbols"
   - Hoisted from "@formatjs#intl-numberformat#es-abstract#is-regex#has-symbols"
   - Hoisted from "@formatjs#intl-numberformat#es-abstract#es-to-primitive#is-symbol#has-symbols"
info Disk size without dependencies: "72KB"
info Disk size with unique dependencies: "72KB"
info Disk size with transitive dependencies: "72KB"
info Number of shared dependencies: 0
Done in 0.87s.

I fixed it by adding this to the webpack config, but I’m not sure if this is the best solution:

    node: { global: true } // Fix: "Uncaught ReferenceError: global is not defined"