Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AoT compilation fails #16

Closed
Rob-Post opened this issue Jan 24, 2017 · 3 comments
Closed

AoT compilation fails #16

Rob-Post opened this issue Jan 24, 2017 · 3 comments

Comments

@Rob-Post
Copy link

Rob-Post commented Jan 24, 2017

When running AoT compilation ( node_modules/.bin/ngc -p tsconfig-aot.json ) it fails with the following error:

Unexpected value 'VirtualScrollModule in /node_modules/angular2-virtual-scroll/dist/virtual-scroll.d.ts' imported by the module 'AppModule in /app/app.module.ts'

tsconfig-aot.json

{
  "compilerOptions": {
    "module": "es2015",
    "moduleResolution": "node",
    "target": "es5",
    "noImplicitAny": false,
    "sourceMap": true,
    "mapRoot": "",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2015",
      "dom"
    ],
    "outDir": "lib",
    "skipLibCheck": true,
    "rootDir": ".",
	"typeRoots": [
      "node_modules/@types"
    ]
  },
  "angularCompilerOptions": {
    "genDir": "./app/ngfactory",
    "entryModule": "./app/app.module#AppModule"
  }
}

app.module.ts (excerpt)

import { VirtualScrollModule } from 'angular2-virtual-scroll';

@NgModule({
  imports: [
	VirtualScrollModule,
  ],
  declarations: [

  ],
  bootstrap: [ AppComponent ]
})
@Rob-Post Rob-Post changed the title Webpack AoT fails AoT compilation fails Jan 24, 2017
@jsen-
Copy link

jsen- commented Feb 2, 2017

Seems like AOT does not like the distributed .js file, but requires the original .ts file.
This seems to work...

// FIXME: quick-hack to fix AOT
import { VirtualScrollModule } from "../../resources/angular2-virtual-scroll/src/virtual-scroll"

@ronzeidman
Copy link

Notice that if you provide the metadata.json files alongside the .js files (meaning you need to AOT compile this library in advance) the .ts files are no longer needed.
https://medium.com/@isaacplmann/getting-your-angular-2-library-ready-for-aot-90d1347bcad#.wxi37ud13

@rintoj rintoj closed this as completed in 23e2809 Feb 14, 2017
@rintoj
Copy link
Owner

rintoj commented Feb 14, 2017

Fixed with v0.1.0. Now this library is AoT enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants