Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari unable to load generated pages #264

Closed
erantapaa opened this issue Apr 28, 2016 · 5 comments
Closed

Safari unable to load generated pages #264

erantapaa opened this issue Apr 28, 2016 · 5 comments

Comments

@erantapaa
Copy link

Perhaps this is expected, but I'll mention it anyway...

The index.js created by gatsby new ... doesn't load on Safari 8.0.5 (OS X 10.10.3).

To replicate:

$ gatsby new blah
$ cd blah
$ gatsby develop

When loading http://0.0.0.0:8000 Safari just shows a blank page and reports the following errors in the console:

[Error] TypeError: undefined is not a function (evaluating 'Object.assign({}, this.props, {
      "style": styles
    })')
  perform (undefined, line 18)
  batchedUpdates
  batchedUpdates
  _renderNewRootComponent
  ReactMount__renderNewRootComponent
  _renderSubtreeIntoContainer
  render
  React_render
  (anonymous function)
  exports
  (anonymous function)
  loadConfig
  eval code
  eval ([native code], line 0)
  (anonymous function) (bundle.js, line 2902)
  __webpack_require__ (bundle.js, line 556)
  fn (bundle.js, line 87)
  eval code
  eval ([native code], line 0)
  (anonymous function) (bundle.js, line 586)
  __webpack_require__ (bundle.js, line 556)
  (anonymous function) (bundle.js, line 579)
  global code (bundle.js, line 580)
[Error] Failed to load resource: unsupported URL (performance-now.map, line 0) webpack:///~/react-responsive-grid/~/react-page-width/~/raf/~/performance-now/lib/performance-now.map
@benstepp
Copy link
Contributor

Safari 8.0 doesn't support Object.assign(), and babel uses it all over the place when transforming JSX. You're going to have to polyfill it. Here's one of the easier ways to do so.

npm install --save babel-plugin-transform-object-assign
// .babelrc
{
  "presets": ['react', 'es2015', 'stage-0'],
  "plugins": [
    'transform-object-rest-spread',
    'transform-object-assign'
  ]
}

@KyleAMathews
Copy link
Contributor

Hmmm... perhaps we should just add this plugin to the starters given there's a decent % of browsers in use that don't support Object.assign yet like Safari 8.

@KyleAMathews
Copy link
Contributor

@benstepp actually could you just add this to core in #277 actually? Any reason not to?

@benstepp
Copy link
Contributor

benstepp commented May 8, 2016

Sounds good.

benstepp added a commit to benstepp/gatsby that referenced this issue May 8, 2016
This is done to support older browsers. Fixes gatsbyjs#264
@KyleAMathews
Copy link
Contributor

Fixed in #279 and released in 0.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants