How to add an additional loader in angular?

Viewed 771

I new in Angular, I try to import a .js file to my app.component.ts, the file is part of an npm package

import { Component } from '@angular/core';

import { ListenerScroll } from '../utils/listener-scroll';

@Component({...});

but I have this error:

Module parse failed: Unexpected token (8:28)
File was processed with these loaders:
 * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
 * ./node_modules/@ngtools/webpack/src/ivy/index.js
 * ./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
| 
| export class ListenerScroll {
>       static listenerScrollAdded = false;
|       static listenerScroll = [];
| 

I understand that static properties are not available in all browsers so I have to "convert" the .js file, in webpack you can add babel and it converts the modern language into one that browsers can read, how could something be done similar in angular?

Thank you for your help! :)

0 Answers
Related