tomwanzek / d3-ng2-service

A D3 service for use with Angular.
MIT License
205 stars 42 forks source link

Failed AOT compilation #130

Open marnec opened 4 years ago

marnec commented 4 years ago

Hi there, using Angular 9.1.7 Whenever I include D3Service among provides, I get this error:

Uncaught Error: Angular JIT compilation failed: '@angular/compiler' not loaded!
  - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.
  - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?
  - Alternatively provide the compiler with 'import "@angular/compiler";' before bootstrapping.
rwlogel commented 4 years ago

I solved this by adding adding this to ngcc.config.js (in the same directory as angular.json):

module.exports = {
  packages: {
    // The d3-ng2-service package is really old and ngcc needs
    // help to know how to build it.
    'd3-ng2-service': {
      entryPoints: {
        '.': {
          override: {
            module: './index.js'
          }
        }
      }
    }
  }
};
martyandreas commented 2 years ago

@rwlogel thank you, this has solved the problem for me!