angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

compiler path aliases don't work with AoT?

Open JBoothUA opened this issue 8 years ago • 2 comments

Versions

Angular CLI: 1.6.1
Node: 8.0.0
OS: win32 x64
Angular: 5.1.1
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

@angular/cli: 1.6.1
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.1
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.6.2
webpack-bundle-analyzer: 2.9.1
webpack-merge: 4.1.1
webpack: 3.10.0

Repro steps

I'm stuck on an error trying to get ng2-charts working with the angular-cli and AoT.

ERROR in : Unexpected value 'ChartsModule in D:/Repos/smartcommand-webapp/WebApp/ui/node_modules/ng2-charts/bundles/ng2-charts.umd.min.js' imported by the module 'DashboardModule in D:/Repos/smartcommand-webapp/WebApp/ui/src/app/dashboard/_dashboard.module.ts'. Please add a @NgModule annotation.

(The build works if I do not use AoT)

I'm not sure if it is directly related to ng2-charts, or maybe how I'm 'aliasing' it?

I had to do this

"compilerOptions": {
	"outDir": "../out-tsc/app",
	"baseUrl": "./",
	"paths": {
		"ng2-charts": [ "../node_modules/ng2-charts/bundles/ng2-charts.umd.min.js" ]
	},

in order for the chart to render correct in the NON-aot build, so I'm assuming that is correct, but maybe that doesn't work with AOT? or the ng2-charts package itself?

Observed behavior

Path works without AOT Path throws error with AOT

JBoothUA avatar Dec 15 '17 20:12 JBoothUA

Dear @JBoothUA, I have some error same with your issue. Do you resolve it? Can you suggest to me some ideas?

shadel avatar Jan 23 '18 07:01 shadel

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.