Demo maps throw error: TS2591: Cannot find name 'Buffer'
MichaelLangbein opened this issue · 2 comments
Describe the bug
Running the demo-maps project in ukis-frontend-libraries fails with the error-message:
error TS2591: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add `node` to the types field in your tsconfig.
190 data.content.map(c => Buffer.from(c, 'base64').toString('ascii'));
To Reproduce
Steps to reproduce the behavior:
- Run 'npm run start'
- See error
Versions
App
- Angular: 11.2.14
- Node: 16.7.0
- Clarity: 5.1.1
- UKIS: 7.3.2-next.3
Device:
- Type: Notebook
- OS: Windows
- Browser Chrome 93.0.4577.63
Additional context
The error is quickly fixed by adding "types": ["node"]
to demo-map
's tsconfig.app.json. But: we cannot expect every user of our libraries to alter their tsconfig for us. Instead it would likely make sense to use a browser- and node-compatible version of Buffer, like this one, as suggested here
I think this is only in our not build system and the fix you propose is already in 4919869
The build libs should use /feross/buffer through browserify like described here https://github.com/feross/buffer#the-buffer-module-from-nodejs-for-the-browser
With browserify, simply require('buffer') or use the Buffer global and you will get this module.
Well, perfect, if this is already handled than this issue can be closed. Thanks!