简体   繁体   中英

Why is behavior different for ember serve vs index.html?

I'm using ember-cli 0.0.33

I created a default app using

ember new stealth

Then I built it using

ember build --environment=production

Then I uploaded the index file to https://d1mungh8jer63d.cloudfront.net/index.html and asset files to ../assets/* and then opened the index url in Chrome and Firefox and got a blank white screen on both.

Next, without changing anything, I ran

ember s --environment=production --live-reload=false

Which gives me the exact same dist files. I open my browser to localhost:4200 and the page had Welcome to Ember.js .

But both index.html and localhost:4200 have the same source:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Stealth</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <base href="/" />

    <link rel="stylesheet" href="https://d1mungh8jer63d.cloudfront.net/assets/vendor-d41d8cd98f00b204e9800998ecf8427e.css">
    <link rel="stylesheet" href="https://d1mungh8jer63d.cloudfront.net/assets/stealth-de3c495d5da3bffcdc865aaa60f76ab3.css">
  </head>
  <body>
    <script>
      window.StealthENV = {"baseURL":"/","locationType":"auto","EmberENV":{"FEATURES":{}},"APP":{}};
      window.EmberENV = window.StealthENV.EmberENV;
    </script>
    <script src="https://d1mungh8jer63d.cloudfront.net/assets/vendor-5429f75166356b28c3e42dd401abaf36.js"></script>
    <script src="https://d1mungh8jer63d.cloudfront.net/assets/stealth-271c63d147abd689113e3c0bae25a9e5.js"></script>
    <script>
      window.Stealth = require('stealth/app')['default'].create(StealthENV.APP);
    </script>
  </body>
</html>

Why did one "work"/display Welcome to Ember.js , while the other just displayed a blank white screen? And how do I make index.html "work"?

(The OP was able to resolve his own problem. I'm just pasting his own answer here, so it can be found)

If you need to deploy your ember project to a subdirectory, use the baseUrl configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM