steveblue / angular2-rollup

CLI for bundling Angular with Rollup and Closure Compiler
121 stars 18 forks source link

could you give a demo show how to use angular2-rollup? #21

Closed dyh333 closed 6 years ago

dyh333 commented 6 years ago

hi, @steveblue . I am trying use this repo to build my ng2+ project, but met some confused, wouly you give a simple demo repo showing how to build ng2+ with angular2-rollup?

thanks

steveblue commented 6 years ago

npm install -g angular-rollup codelyzer rimraf mkdir new-app && cd new-app ngr scaffold (lots of options here, use ngr --help to see them all) ngr build dev --watch --serve to run ngc in watch mode for development ngr build prod to build for production ngr serve to view the app you just built for production via localhost

dyh333 commented 6 years ago

hi, @steveblue . thanks your reply. it works well as above command. but if my project is create by angular-cli (ng new my-app), so the file structure is different with yours, and using webpack but not systemjs, can I still use angular-rollup to package?

steveblue commented 6 years ago

You just need to figure out the entry point of the app and see how the system.config, tsconfig and closure.conf operate with your codebase. If you've never bundled with closure compiler before, prepare for some issues as it requires fairly strict typing, making it also not that compatible with third party libraries. There are workarounds for this in ngr like bundling with Rollup which is more forgiving, but that comes at a penalty of not being able to lazy load or use ADVANCED_OPTIMIZATIONS with closure compiler.

steveblue commented 6 years ago

closing issue from inactivity