question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ActionView::Template::Error (ReferenceError: Map is not defined)

See original GitHub issue

Actual behavior

while try to update react-rails from 1.5 to 2.3.4, it seems there is a big change, i’ve no idea how to fix these problems. I don’t think i am the only person.

System configuration

Sprockets or Webpacker version: i just don’t know how to check this React-Rails version: 2.3.4 Rect_UJS version: i just don’t know how to check this Rails version: 5.1.4 Ruby version: ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux] Since I user docker-compose, Dockerfile: FROM rails:onbuild


  1. upgrade rails to 5.1.4
  2. upgrade react-rails to 2.3.4
  3. bundle install
  4. modify the application.rb as you mentioned
  5. rails g react:install
  6. add prerender: true to my componet
  7. restart my docker container, then get error:
  8. below is the debug result by web-console,maybe some help:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
p-salidocommented, Dec 24, 2017

@oiahoon I had this issue, resolved it by adding babel-polyfill.

Step 1: download https://npm-cdn.herokuapp.com/babel-polyfill@6.26.0/dist/polyfill.min.js (per https://babeljs.io/docs/usage/polyfill/), put it in vendor/assets/javascripts

Step 2: add to application.js or something like vendor/assets/javascripts/vendor.js if you have it:

//= require babel-polyfill.min
1reaction
BookOfGregcommented, Dec 20, 2017

You don’t have to only use ES6, we prefer ES6 to ES5 but in general ES5 is more compatible with things.

Now I think about it, if you’re using therubyracer as the JS runtime, you may need to swap to mini_racer as mini_racer uses a newer version of Chrome’s LibV8 which may enable ES6 features such as Map.

We dropped therubyracer support a few versions back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: google is not defined - Stack Overflow
I just noticed that in Google Chrome's Javascript console: it gives the following error: [blocked] The page at mypage.com/GoogleMapPage.aspx ran insecure ...
Read more >
Import Maps Under the Hood in Rails 7 - AppSignal Blog
Learn how to install JavaScript libraries with import maps and how import maps work under the hood in Rails 7.
Read more >
Uncaught ReferenceError: google is not defined | WordPress.org
This seems a dependency issue with Google Maps, are you using the Script Center by any chance? We can add a dependency there...
Read more >
How to Dynamically Import JavaScript with Import Maps
You'll export code as a SystemJS build and how to set the import map type to use SystemJS format. By the end of...
Read more >
Working with JavaScript in Rails - Rails Edge Guides
Applications using import maps do not need Node.js or Yarn to function. If you plan to use Rails with importmap-rails to manage your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found