Cannot find name 'global' when trying to import in Angular
See original GitHub issueTrying to import via:
import * as tinify from 'tinify'
But getting:
ERROR in node_modules/tinify/lib/tinify/Error.d.ts(1,36): error TS2304: Cannot find name 'global'.
Any ideas?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
angular 2 webpack 2 error cannot find name 'global'
Have you tried setting: typings.d.ts //If you don't see this file under src folder create one. With: declare var global: any.
Read more >Cannot find name 'require' Error in TypeScript | bobbyhadz
To solve the "Cannot find name require" error, install the node types by running npm i -D @types/node . If the error is...
Read more >$localize Global Import Migration - Angular
This package requires a global $localize symbol to exist. ... If this import is missing, you will see an error message like this:....
Read more >TypeScript configuration - Angular
A given Angular workspace contains several TypeScript configuration files. At the root tsconfig.json file specifies the base TypeScript and Angular compiler ...
Read more >NG0301: Export not found! - Angular
Angular can't find a directive with {{ PLACEHOLDER }} export name. The export name is specified in the exportAs property of the directive...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi there,
Angular is a front-end framework. This is a NodeJS library and you need to use it server side (back-end). Unfortunately the API does not support being used in the front-end (like Angular does). The reason being that it would make it hard to hide sensitive data from the user (like you API key).
In short, this will not be usable with just Angular. You would need a back-end to handle the compressions. What I would recommend is posting the image from your Angular application to the server and have the server import Tinify and deal with the compression. You can then return the compressed image to the Angular application if you want to give it back to the user.
Hope this clears up the issue!
Thanks Simon, understood about this intending for strictly backend node use. We were trying to see if we could convert the node version into a front-end usable component (we’ve actually done that in the past with other plugins).
Either way, appreciate the response!