ng2-prism icon indicating copy to clipboard operation
ng2-prism copied to clipboard

ng2-prism doesn't compile anymore: AppViewManager removed from Angular2 rc1

Open bbottema opened this issue 8 years ago • 2 comments

ng2-prism still uses old classes from Angular2 since rc1, causing https://github.com/angular/angular2-seed/issues/79.

bbottema avatar May 21 '16 11:05 bbottema

any workaround or ng2-prism alternative?

Shoocky avatar Jun 25 '16 12:06 Shoocky

@Shoocky I'm requiring the library distribution using webpack manually (instead of importing it from the source files), which I acquired from Prism's download builder. Then using Angular's AfterViewChecked lifecycle event I use the global Prism reference (unfortunately).

In the .ts file where I need it:

declare var Prism:any;

require('./lib/prism.ts');

export class YourApp implements AfterViewChecked {
  ngAfterViewChecked():any {
    return Prism.highlightAll();
  }
}

Then to prevent it from being included in my own bundle:

In external.ts (for any other libraries I need to bootstrap this way):

require('./app/lib/prism.ts');

In webpack.config.js:

  entry: {
    'polyfills': './src/polyfills.ts',
    'vendor': './src/vendor.ts',
    'external': './src/external.ts',
    'app': './src/app.ts'
  }

Also include in the CommonsChunkPlugin entry of webpack.config.js.

bbottema avatar Jun 27 '16 19:06 bbottema