tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

Cannot figure out how to prebuild Ember App in Development so that Rails will have it ready on first load. #590

Open ashrocket opened 3 years ago

ashrocket commented 3 years ago

Which operating system and version is the project developed on? All of them (BigSur MacOs 11.2.3 , and Heroku: 4.4.0-1086-aws Linux Kernel, Ubunutu Ubuntu 18.04.5 LTS) Which version of ruby is the project developed on? 2.6.6 Which version of npm is the project developed on? 6.14.11 Which version of ember-cli is the project developed on? ember-cli: 3.13.2 node: 10.24.0 os: darwin x64 What is the rails version? Rails 6.0.3.5 What is the ember-cli-rails version (from Gemfile)? ember-cli-rails-0.10.0 What is the ember-cli-rails-addon version (from package.json)? ember-cli-rails-addon": "^0.10.0" Is your application server multi-threaded (such as puma and unicorn) or is it multi-process (such as thin and webrick)? puma in production, and development What are the contents of config/initializers/ember.rb? EmberCli.configure do |c| c.app :matching_inbox, yarn: true end Yarn version 1.17.3 What are the contents of the Rails' view that renders the Ember application?

<%= render 'layouts/partials/head_tags' %>
      <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
      <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
      <% unless Rails.env.test? || @layout_no_ember %>
        <%= javascript_include_tag "https://polyfill.io/v3/polyfill.min.js" %>
        <%= include_ember_script_tags :ember_app_name, prepend: ember_prepend_path %>
        <%= include_ember_stylesheet_tags :ember_app_name, prepend: ember_prepend_path %>
        <%= javascript_include_tag 'application-saved-grant-index', 'data-turbolinks-track' => true %>
      <% end %>
      <meta name="turbolinks-visit-control" content="reload">
    </head>

This results in EmberCli::BuildError - :ember_app_name has failed to build:

How are the EmberCLI-related routes defined? in routes.js files for each component

How is the application deployed? I'm primarily concerned about making it work in development mode, so it's not being deployed, it's just being run. EmberApp is in RAILS_ROOT/ember_app_name directory

ashrocket commented 3 years ago

After waiting a bit, the App builds and then a refresh works great.


Environment: development

Build successful (14948ms)

Slowest Nodes (totalTime => 5% )              | Total (avg)         
----------------------------------------------+---------------------
Package /assets/vendor.js (1)                 | 3011ms              
ember-auto-import-analyzer (6)                | 2341ms (390 ms)     
broccoli-persistent-filter:EslintValid... (4) | 1955ms (488 ms)     

I will happily document the solution to this problem if you can give me any hints on how to resolve it

nruth commented 3 years ago

As you've found, manually reloading the page will work if you wait long enough, but it's not what's supposed to happen. It's supposed to wait for the app to compile (the browser stuck on page-loading) until the app compiles. We shouldn't get that error page. I guess something broke between ember-cli-rails-addon and newer versions of ember-cli.

This and the ember addon don't get much time spent on them, so if you're making a new app you may want to look for another way to host and deploy.

Samsinite commented 2 years ago

@ashrocket and @nruth this PR https://github.com/thoughtbot/ember-cli-rails/pull/577 (that was merged) should fix it so that an error page is not shown while the app is building, not released yet FYI.