NX & Angular - BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default

Viewed 14

I have have a monorepo using angular and NX and I have a UI project in my apps folder use the data-access library I added.

Directory structure of projectType=library and apps:

/apps
    /ui
       /src
          /app
             /component.ts    <- use it here
/libs
   /database
      /src
         /lib
            database.ts

What is in database.ts file:

import { Injectable } from '@angular/core'

@Injectable({
  providedIn: 'root'
})
export class Database {
  constructor() {}

  get() {
    console.log('you are calling get!')
  }
}

This is where things get weird and I have issues. I can import it into my component.ts file like so:

import { Database } from '@mystuff/database';

But now no matter what I do...add it to providers, inject in constructor...I just want to use the methods! I get the following list of errors...I'm only showing the first few...it is quite long:

image

I have tried using a custom webpack.config, messed with tsconfig.json & angular.json...no luck!

Can anyone please hold my hand and tell me what I need to do to have this work! My team and I have been stuck on this for too long

0 Answers
Related