Building For Production

Hello, I am just beginning with javascript frameworks and I have 2 questions.


1). After calling the ember build --env production, the system generates the files in the dist/ folder.

But how can I use them on my website??

After calling the index.html file (from “dist /”), I do not see anything on the screen (on the server localhost: 4200 result is correct).


2). What keeps the backend of this forum? PHP, .NET?


I ask for your understanding and support. L

Are you loading index.html via http(s)? If not, that’s probably the issue. You will need a webserver to serve index.html. You can view use your browser’s javascript console to view relevant errors. If you report them back here they will help with debugging.

The forum is a Discourse instance, which is powered by Ruby.

If your website is running Apache add this to your public folder:

https://github.com/broerse/ember-cli-blog/blob/21b6db2f7c520244602624a0df3ae80f4f2b10ed/public/.htaccess

What is your backend?

To also answer point 1)

npm install -g http-server

Go to the dist folder and type:

http-server

Then go to http://localhost:8080/ to see your App.

Alternative if you have Python in your system:

python -m SimpleHTTPServer

Thank you all for your reply!


To view the contents of the dist/ folder, I used web server based on Apache (local and real). With .htaccess file (as in php frameworks): RewriteEngine On RewriteCond% {REQUEST_FILENAME}! -f RewriteCond% {REQUEST_FILENAME}! -d RewriteRule ^ (. *) $ index.html [QSA, L]


Unfortunately, after the change: RewriteEngine On RewriteRule ^ index \ .html $ - [L] RewriteCond% {REQUEST_FILENAME}! -f RewriteCond% {REQUEST_FILENAME}! -d RewriteRule (. *) index.html [L] </ IfModule>

I still do not see anything on the screen (under ember server everything is ok).


I try to run this example: Quick Start

and getting these files on dist/: Zip file from tinyupload.com


Apart from instructions in the Getting Started, I have to do something else?

Thanks. L

What errors do you see in your browser’s javascript console?

Javascript Error: Uncaught UnrecognizedURLError: /dl/

“dl” is a folder that contains the files from the dist/

L

Change ENV.baseURL (from Ember 2.7 use ENV.rootURL) for production like this to /dl/ https://github.com/broerse/ember-cli-blog/blob/ebc37bb2d0dfe2537ef5a3a90e2124c237f8cd60/config/environment.js#L46

1 Like

Mr. broerse, that was it! :slight_smile:

Thank you all for your help and understanding.

L

1 Like