cankayacan / ngx-library-starter

Angular >2 library stater with rollup.
4 stars 2 forks source link

Angular 5 support + umd bundle + Systemjs #2

Open Ks89 opened 7 years ago

Ks89 commented 7 years ago

Hi! I tried to update my library based on ngx-library-starter to Angular 5 beta 7.

Building process is ok and I can use the library with both webpack and angular-cli, but it fails with Systemjs 0.20.x, because it's using the umd bundle (probably broken).

For instance, It fails while loading all my HTML template files:

Failed to load resource: the server responded with a status of 404 (Not Found)

Unhandled Promise rejection: Failed to load modal-gallery.html ; Zone: <root> ; Task: Promise.then ; Value: Failed to load modal-gallery.html undefined
api.onUnhandledError @ zone.js:661

Can you confirm the problem? If yes, do you have an idea of how to fix this? Is it a configuration problem or something about this plugin https://github.com/cankayacan/rollup-plugin-angular-aot?

Thank u. Ks89

cankayacan commented 7 years ago

That plugin replaces the templateUrl: 'modal-gallery.html' with the template: html-content.

Your bundle should not include templateUrl: anymore but the content of the html file. Could you please check if it is correct?

Ks89 commented 7 years ago

Thank u for the answer.

With Angular 4 everything is ok (styles and templates inlined)

schermata 2017-09-19 alle 20 29 02 copia

With Angular 5 beta 7 + typescript 2.4.2 I have urls instead of the contents.

schermata 2017-09-19 alle 20 29 57 copia

I attached to this post my bundles in a zip file.

angular-modal-gallery.umd.zip

PS: the angular 5 version is really strange, because it seems "not compiled". I don't understand, because this is happening only with the umd bundle

Ks89 commented 7 years ago

I tried to run "ngc" manually and

I think that it's an Angular's bug, or ngc will be deprecated for another utility.

What do you think about this?