brianloveswords / base64url

For encoding and decoding base64url!
MIT License
225 stars 44 forks source link

Doesnt work with Angular 7 still getting buffer is not defined #44

Open Gabb1995 opened 5 years ago

Gabb1995 commented 5 years ago

Doesnt work with Angular 7 still getting buffer is not defined, can someone else confirm?

Originally posted by @Gabb1995 in https://github.com/brianloveswords/base64url/issues/33#issuecomment-481248229

Package.json


    "@angular/animations": "^7.1.4",
    "@angular/cdk": "^7.3.2",
    "@angular/common": "~7.1.0",
    "@angular/compiler": "~7.1.0",
    "@angular/core": "~7.1.0",
    "@angular/flex-layout": "^7.0.0-beta.23",
    "@angular/forms": "~7.1.0",
    "@angular/material": "^7.3.2",
    "@angular/platform-browser": "~7.1.0",
    "@angular/platform-browser-dynamic": "~7.1.0",
    "@angular/router": "~7.1.0",
    "@fortawesome/fontawesome-free": "^5.7.2",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "base64url": "^3.0.1",
    "core-js": "^2.5.4",
    "dayjs": "^1.8.11",
    "hammerjs": "^2.0.8",
    "lodash": "^4.17.11",
    "ngx-color-picker": "^7.3.1",
    "ngx-openlayers": "^0.8.22",
    "rxjs": "^6.3.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"

ReferenceError: "Buffer is not defined"
    decode base64url.js:14
    getConfigFromLegacy whitelabel.service.ts:294
    load whitelabel.service.ts:45
    ZoneAwarePromise Angular
    load whitelabel.service.ts:44
    ngOnInit app.component.ts:74
    RxJS 3
app.component.ts:80:32
    ngOnInit app.component.ts:80
    Angular 10
MylesBorins commented 5 years ago

Can you make a minimal reproduction? A very small project that can recreate the error? If you can put that together it will be much easier to fix

Gabb1995 commented 5 years ago

https://stackblitz.com/edit/angular-budlm1 Demo

remoe commented 5 years ago

The browser doesn't support "Buffer". One need to add Buffer polyfill. On WebPack one can enable it with "Buffer: true":

https://webpack.js.org/configuration/node/