Savinvadim1312/YoutubeClone

You may need an additional loader to handle the result of these loaders.

Closed this issue · 6 comments

I'm having a issue while git checkout ui & yarn install && yarn start gives a following errors,

./components/VideoListItem/VideoListItem.tsx 20:21
Module parse failed: Identifier directly after number (20:21)
File was processed with these loaders:
 * ../../../home/gitpod/.nvm/versions/node/v16.13.0/lib/node_modules/expo-cli/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   var viewsString = video.views.toString();
| 
>   if (video.views > 1_000_000) {
|     viewsString = (video.views / 1_000_000).toFixed(1) + 'm';
|   } else if (video.views > 1_000) {
./screens/VideoScreen/VideoScreen.tsx 27:21
Module parse failed: Identifier directly after number (27:21)
File was processed with these loaders:
 * ../../../home/gitpod/.nvm/versions/node/v16.13.0/lib/node_modules/expo-cli/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   var viewsString = video.views.toString();
| 
>   if (video.views > 1_000_000) {
|     viewsString = (video.views / 1_000_000).toFixed(1) + 'm';
|   } else if (video.views > 1_000) {

The issue is with the number format I used: 1_000_000. What version of NodeJS do you have? You might have to upgrade the nodejs version to support the new number format 1_000_000.

Still facing the same issue after update from v16.13.0 -> v17.4.0 I'm opening the app on web.

On web it might be supported. Then, change the numbers into normal format: 1_000_000 = 1000000

Ok, Thanks

I got the following warning after changing it from 1_000_000 = 1000000

let viewsString: number
Type 'string' is not assignable to type 'number'.ts(2322)

Fixed the above issue by passing viewsString as any = let viewsString = video.views as any;