adobe / adobe/aem-headless-client-js

Impossible to use this framework on browser without polyfilling node

Open
#84 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
34
Forks
13
Avg merge
8h 14m
Merged PRs (30d)
2

Description

Hello,

I am trying to use the aem-headless-client-js in a Angular 18 application. Since Angular 12, the default webpack config of Angular no longer polyfills the node API by default.
We are currently unable to use the framework as we are having a runtime issue: "ReferenceError: process is not defined."

When looking at the error stack, the issue comes from the aio-lib-core-errors, which seems to be developed to work under a node runtime... it is doing a require('util') which does not work in a browser.

Suggestions to make it easier to install on browser js/ts apps:
- Make sure all the dependencies are usable in a browser.
- Deliver a build of your framework including the required polyfills.

In any scenario, it would be great to also include the TypeScript types of your framework for easier adoption in TypeScript apps like Angular.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the ReferenceError in an Angular 18 browser application and trace the stack to aio-lib-core-errors, especially its require('util') usage. Check the client dependencies and packaging for browser compatibility and TypeScript type delivery; done means the framework can be adopted without Node polyfills and exposes the requested types.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.