-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
include metadatafiles to make aot compatiable. #1004
Conversation
@ammar91 Nice work! I think you aren't supposed to source the Have you managed to produce a build that can be used as a dependency in an Angular project, and successfully compile with |
@adrienverge Thanks. Yes, I'm successfully able to compile my Angular project by having PNG as dependency (with the Pull Request I made). What errors you are having when you run ngc? |
When I clone your branch into my project's
(Angular 2.0.1) |
Are you sure you checked out the 'ato' branch instead of master? |
Of course :)
I just |
Does it have primeng.metadata.json next to primeng.d.ts?
|
Yes... By the way, running |
Can you paste your tsconfig.json here? |
Sure, it's {
"compilerOptions": {
"target": "ES5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": true,
"noImplicitAny": true,
"noImplicitReturns": true
},
"files": [
"src/app/app.module.ts",
"src/app/main.ts",
"typings/browser.d.ts"
],
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
} Do you have any plunker / demo / open-source project using your |
@adrienverge I created one https://github.com/ammar91/aot-primeng/tree/master |
@ammar91 Thanks!! Unfortunately this proof of concept still doesn't work for me (same error) with tsc 2.0.3 and Angular 2.0.1. I'm opening an issue on your aot-primeng repo so we can continue debugging there: ammar91/aot-primeng#1. |
Hey, here is some feedback:
Is there any pre-compilation needed? |
@adrienverge Thanks for your feedback.
Yes, that is because when you clone the branch it doesn't contain compiled js files. That is only available in the generated npm package. |
I'm sorry but this still doesn't work, although It would be good to have clear instructions on how you proceed to get it working. For instance, the following instructions fail at several points: git -C /tmp clone https://github.com/ammar91/aot-primeng.git
cd /tmp/aot-primeng
npm install
rm -rf node_modules/primeng
cd node_modules
git clone -b ato https://github.com/ammar91/primeng.git
cd primeng
npm install
npm run tsc
# fails because of missing 'moment' definition files
npm i moment
npm run tsc
# fails because of missing '../compiled/showcase/app.module.ngfactory'
npm run ngc
npm run tsc
cd ../..
ngc -p ./tsconfig.aot.json
# Error: Unexpected value 'DialogModule' imported by the module 'AppModule' |
This works for me without any errors.
|
What is the status on this? Any help needed? I'm in dire need of this feature but I'd rather have it when beta18 does come out.. |
We'll add AOT support in 1.0.0-RC1 (end of october) |
Oops, a little disappointed to know this pull request has been closed without merge. Wasn't that helpful? |
I don't think metadata.json files should be under version control, shouldn't we generate them before publishing the npm package instead? |
Let's discuss at 871 |
@cagataycivici curious what the status o 1.0.0-RC1 is, I really need AOT compilation support for my project |
I'm able to successfully produce metadata files for primeng by following the below steps.
https://medium.com/@isaacplmann/getting-your-angular-2-library-ready-for-aot-90d1347bcad#.mtna6ixy8
I did make several changes along the way by looking at the error messages during compilation. Those are very minor and quick fixes which are mentioned here (
https://medium.com/@isaacplmann/making-your-angular-2-library-statically-analyzable-for-aot-e1c6f3ebedd5#.nq9gqm4o2), specifically the 3rd one.
However, there were two major changes
Remove typings.json in favor of typescript 2.0, new way of defining type declaration files
https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/
Update webpack to webpack2 beta
This is because uglifyjs plugin break with webpack1, and after upgrading to webpack2, content now being serve from http://localhost:8080 instead of http://localhost:880/webpack-dev-server
But this should be configurable, just didn't get a chance to look into this one.
Isolate the App Module and Entry file (Application.ts), otherwise webpack complain about Module error described here A dependency to an entry point is not allowed in multiple page app webpack/webpack#2894
Please let me know if anything else needed, I would be happy to assist further.