Skip to content
This repository has been archived by the owner on Feb 16, 2019. It is now read-only.

template3 (single js out file) doesn't work with ng2 #11

Open
golechwierowicz opened this issue Aug 30, 2016 · 7 comments
Open

template3 (single js out file) doesn't work with ng2 #11

golechwierowicz opened this issue Aug 30, 2016 · 7 comments

Comments

@golechwierowicz
Copy link

golechwierowicz commented Aug 30, 2016

Hi, great activator!

However when doing sbt dist for production and then launching the binary file it fails with

http://localhost:9000/assets/lib/rxjs/rx.js Failed to load resource: the server responded with a status of 404 (Not Found)
zone.min.js:1 Error: (SystemJS) Error: XHR error (404 Not Found) loading http://localhost:9000/assets/lib/rxjs/rx.js(…)e.invoke @ zone.min.js:1

@joost-de-vries
Copy link
Owner

I couldn't replicate your issue. I called sbt stage and then ran the binary and the NG2 application starts just fine.

@joost-de-vries
Copy link
Owner

Since I couldn't replicate the issue and haven't heard from your for quite a while I'm closing the issue.

@avanwyk
Copy link

avanwyk commented Oct 17, 2016

I know you have closed the issue, but I am having the same problem if I follow your readme.

Running:
sbt stage
it works, however, JS is served as more than one file.

Running:
sbt stage -tsCompileMode=stage
it gets the same error as @golechwierowicz :

zone.min.js:1 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:9000/assets/app/main.js(…)
e.invoke @ zone.min.js:1
n.run @ zone.min.js:1
(anonymous function) @ zone.min.js:1
e.invokeTask @ zone.min.js:1
n.runTask @ zone.min.js:1
a @ zone.min.js:1
invoke @ zone.min.js:1

@joost-de-vries joost-de-vries changed the title does not work with sbt dist template3 (single js out file) doesn't work with ng2 Oct 19, 2016
@joost-de-vries
Copy link
Owner

joost-de-vries commented Oct 19, 2016

The template3 variant hasn't been ported to ng2 final yet.
It's mostly an ng2 matter with a little bit of knowledge of Play required.

What needs to be done is that the <script/> downloads and the SystemJs config need to be updated for Angular2. What's different in the SystemJs config is that either the config shouldn't do anything about loading the app code and we should load it using a script tag. Or we should configure SystemJs to go to this single file for all app modules.

I'm pretty busy the coming weeks. A pull request is welcome.

@camilosampedro
Copy link

I have tried to run the single javascript file compilation. The only problem I have is that in the generated main.js there are a lot of references to Angular2 dependencies. For example, there is a line that is:

System.register("app/app/app.component", ['@angular/core'], function //... 

All those files are being requested by the browser and they are not shipped with that main.js, they still cannot be accessed because there is nothing on localhost:9000/@angular/core.

The only javascript files referenced in this index2.html are

  • angular2-polyfills.js
  • system.js
  • Rx.js
  • angular2.dev.js
  • main.js

None of them having problems loading.

I run using activator -DtsCompileMode=stage ~run

I know this template is not ported yet for this template, and I'm really sorry for bothering you with this 😓 , I just don't really know what is the missing part on this. Are dependencies not being compiled inside main.js?

I attach my main.js, I have changed the HTML System import script for:

<script>
    System.import('app/main')
        .catch(console.error.bind(console));
</script>

I don't really have any urges with this, so don't worry.

Thank you! 😃

@SadatAnwar
Copy link

@joost-de-vries any updates here? I know you said you are busy, but just wanted to know if you will be looking at this anytime soon? I too am unable to get the index2 to work. I am getting 404 of angular2-polyfills.js, angualr2.dev.js files

Thanks

@museOnSite
Copy link

Hi,
Some updates about single js file compilation ? I'm struggling too running my app in production.
Thanks

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

No branches or pull requests

6 participants