So I am building an Angular CLI 6 application and I wanted to implement the Chalk package to have some styling in my console logs.
For testing purposes, I've imported Chalk in my app.component.TS file as follows:
import { component } from '@angular/core';
import * as chalk_ from 'chalk';
@Component({
//not important
})
export class AppComponent {
title = 'My App';
constructor() {
console.log(chalk.blue('Hello'));
}
chalk.blue gives me the error: Property blue does not exist. When I change that into chalk.default.blue it works and VS code gives me no errors.
When I check the console in the browser I get the error: index.js:8 Uncaught ReferenceError: process is not defined.
Can someone help me out with this? I have also tried Colors and I've noticed that all these packages require you to use require() to implement them. But this is ES5 style...
const chalk = require('chalk');
or
var colors = require('colors/safe');