TypeError: Object.values is not a function during Exporting Routes on build
See original GitHub issueI’m building from the sass template with my config file:
import ExtractTextPlugin from 'extract-text-webpack-plugin'
export default {
getRoutes: async () => {
return [
{
path: '/',
component: 'src/containers/Home',
},
//+ other routes
and App,js has the basic example for routing:
import React from 'react'
import { Router } from 'react-static'
import Routes from 'react-static-routes'
import './app.scss'
export default () => (
<Router>
<Routes />
</Router>
);
dev server from localhost works well but this error shows up on build:
=> [✓] App Bundled: 31475.245ms
=> Exporting Routes...
TypeError: Object.values is not a function
at _callee$ (C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:177:32)
at tryCatch (C:\Users\John\Documents\Projects\test-site\node_modules\regenerator-runtime\runtime.js:62:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\John\Documents\Projects\test-site\node_modules\regenerator-runtime
\runtime.js:296:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\John\Documents\Projects\test-site\node_module
s\regenerator-runtime\runtime.js:114:21)
at step (C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:120:191)
at C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:120:437
at C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:120:99
at C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:205:30
at Array.map (native)
at _callee4$ (C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:149:46)
at tryCatch (C:\Users\John\Documents\Projects\test-site\node_modules\regenerator-runtime\runtime.js:62:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\John\Documents\Projects\test-site\node_modules\regenerator-runtime
\runtime.js:296:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\John\Documents\Projects\test-site\node_module
s\regenerator-runtime\runtime.js:114:21)
at step (C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:120:191)
at C:\Users\John\Documents\Projects\test-site\node_modules\react-static\lib\static.js:120:361
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Object.values is not a function JavaScript
I obtain an array of countries. Now when I try to create an array from the values... var labels = Object.values(countries);.
Read more >Error TypeError Object values is not a function - Edureka
I have seen that Object.values() is not supported in all browsers. But I am using the function in Node.js on server side -...
Read more >Express Tutorial Part 4: Routes and controllers - MDN Web Docs
In this tutorial we'll set up routes (URL handling code) with "dummy" handler ... Last of all the module exports the Router object....
Read more >How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >Node.js v19.3.0 Documentation
Function arguments; Callbacks; Object factory; Function factory; Wrapping C++ objects ... Use of the feature is not recommended in production environments.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I also faced this problem. It was because I was using node 6 which does not support Object.values, see Object.values node support. It is safe to use with node version >= 7.5.0
@tannerlinsley we should add
engines
key in package.json of react-static.NM, I got it in the next release. 👍