1
votes

I am using IntelliJ IDEA to develop a Dart/Angular app, from IDEA's new project wizard.

After compiling OK, I tried to load it both from browser (run as a local file) and from Web access (served by Apache2).

But the page (index.html) just show plain "Loading...", no further display etc.

Can anyone give some hint on this?

1
AFAIK loading from local file is not supposed to work due to Chrome browser security limitation. Are you using the router? - Günter Zöchbauer
As I said, the file (or more precisely, the whole compiled output in build directory) was also served from Apache but still only showing "Loading..." and I am using Firefox, Chrome - TaylorR
But it's working in Dartium when launched from IDEA (without build)? - Günter Zöchbauer
@GünterZöchbauer Yes, it does, though the loading is way SLOW... - TaylorR
Only the first time slow or also on successive reloads? - Günter Zöchbauer

1 Answers

1
votes

I think I have solved this problem.

Noticed there are a few lines in the output index.html in the <script>...</script> section:

<script>
    // WARNING: DO NOT set the <base href> like this in production!
    // Details: https://webdev.dartlang.org/angular/guide/router
    (function () {
        // App being served out of web folder (like WebStorm does)?
        var match = document.location.pathname.match(/^\/[_\w]+\/web\//);
        var href = match ? match[0] : '/';
        document.write('<base href="' + href + '" />');
    }());
</script>

Just comment out everything generated by the compiler.

One thing to notice is that: In IDEA I have checked to compile to "Production" and in command line the pub help build tells me the default mode is release, so I really wonder why these lines are not taken out when compiling to production release?