Open ur5us opened 9 years ago
Are there any workarounds for this?
@ur5us what version of rails are you using?
@rgrinberg I'm currently on 3.2.21. I think the problem might be that the asset pipeline tries to compile the map (TBC).
I changed the way to manage bundled files https://github.com/emberjs/ember-rails/pull/448.
Then it stop copying ember-data.js.map
to tmp/ember-rails
.
I think it will fix this issue. Could you try using ember-rails@0.16.4 after cache cleared. If it doesn't please ping me.
@tricknotes I've upgraded us to ember-rails@0.16.4 but the error still happens. It doesn't matter whether the file is copied or not. What matters is that it's in the Sprockets path which it seems to be. Thus, I'm using the following solution: /cc @rgrinberg
config/initializers/rack.rb
:
Rack::Mime::MIME_TYPES.merge!({".map" => "text/plain"})
Further details here: https://github.com/jamesotron/faye-rails/issues/15#issuecomment-6692493.
@tricknotes I'm not entirely sure whether this is a problem with ember-rails, Rails (asset pipeline), Sprockets or even something else. I'm happy to close this issue but add a note to the docs.
thank you @tricknotes , adding MIME_TYPES worked for me, i'm using ember-rails@0.16.3
Fix: Remove this file from the asset pipeline, because it is not valid JavaScript. Add Stuff like this to your application.rb
module App class Application < Rails::Application ... file_ext_exclude = ['.map'] ... end end
Modifying the default rails definition for assets.precompile in production.rb did it for me:
config.assets.precompile = [ Proc.new{ |path| !File.extname(path).in?(['.js', '.css', '.map']) }, /(?:\/|\\|\A)application\.(css|js)$/]
I also had a separate manifest for my ember app so it looked like this:
config.assets.precompile = [ Proc.new{ |path| !File.extname(path).in?(['.js', '.css', '.map']) }, /(?:\/|\\|\A)application\.(css|js)$/, "ember_apps.js" ]
Found that answer here: http://stackoverflow.com/a/10099659
However, note that my asset precompilation took forever on Heroku and I noticed that things were being precompiled more than once. So there might be some issue with this workaround.
I had the same problem when I've deployed to heroku. I've changed the syntax in my code from:
I'm actually a noob with Ember and I didn't want to change many things in my rails config. It's worth saying the ember code in my application is small.
Later I found the same solution here: http://stackoverflow.com/a/32534114/642496
My question: Is this a valid/good solution? Is there a negative impact on app performance or for me as developer? Thanks!
I hit this problem and have tried all the above work arounds with no luck. What's worse is I'm not even using ember data. Can ember-data be removed somehow??
@hernanvicente It's the same. The former is ES6 syntax, the latter E3/5. It looks like it's related to the uglifier
gem: http://stackoverflow.com/questions/30422437/execjsprogramerror-unexpected-token-punc-expected-punc-when-running/32534114#comment50344169_30422437
@baraka2000 It's hard to tell without further details but the following might help (still using my solution above and assuming your issue happens in dev mode?):
# make sure you stop your rails server, especially if you're using spring app preloader, then
bundle exec rake tmp:cache:clear
In your Gemfile, you might try the following:
gem 'ember-rails'
gem 'ember-data-source', require: false
Start your server and try again.
After upgrading to version
0.16.1
the build consistently fails, that is, I'm not able to runbundle exec rake assets:precompile
successfully. Here's the stack trace which suggests that there is an issue withember-data.js.map
:Even more annoyingly I can't just downgrade the gem via specifying version
0.16.0
in the Gemfile, at least not until I manually executerm -rf tmp/ember-rails/
.Potentially related: #343 #357