Currently, I am facing an issue trying to integrate npm's ng2-prism with angular2-seed. The problem arises when importing angular2/http, which has recently been moved under @angular.
Even though I expected webpack's configuration aliases to handle this seamlessly, for some reason, the alias is not being picked up.
Below is the configuration, untouched from the seed:
In vendor.ts - the only file edited to include ng2-prism in the vendor bundle:
// Angular 2
import '@angular/platform-browser-dynamic';
import '@angular/platform-browser';
import '@angular/core';
import '@angular/http';
import '@angular/router-deprecated';
import 'ng2-prism';
The import in ng2-prism's source code appears straightforward (codeblock.component.d.ts:1:66):
import { AfterViewChecked, AfterContentChecked, ElementRef } from 'angular2/core';
The alias set up in webpack.config.js
(...)
resolve: {
root: [ path.join(__dirname, 'src') ],
extensions: ['', '.ts', '.js', '.json', '.css', '.html', '.less'],
alias: {
(...),
'angular2/core': path.join(__dirname, 'node_modules', '@angular', 'core', 'index.js'),
(...)
}
},
(...)
Upon logging the result, it shows that the correct absolute folder to resolve the alias was detected.
However, upon running npm start, I encounter the following error:
ERROR in [default] C:/workstation/simple-java-mail/src/main/webapp/node_modules/ng2-prism/src/codeblock.component.d.ts:1:66 Cannot find module 'angular2/core'.
Certainly, ng2-prism needs to update its dependencies, but this scenario could arise with any library at some point.
It remains unclear why the import cannot be resolved. Any insights on what could be missing?