SyntaxError: /myObject/node_modules/cesium/index.js: 'return' outside of function (9:4)
See original GitHub issuehello, I created a new react project and found that it didn’t work. Throw the following error:
Failed to compile.
./node_modules/cesium/index.js
SyntaxError: /myObject/node_modules/cesium/index.js: 'return' outside of function (9:4)
7 | if (process.env.NODE_ENV === 'production') {
8 | module.exports = require(path.join(__dirname, 'Build/Cesium/Cesium'));
> 9 | return;
| ^
10 | }
11 |
12 | // Otherwise, use un-optimized requirejs modules for improved error checking. For example 'development' mode
/src/App.js
import React from "react";
import { hot } from "react-hot-loader";
import { Cartesian3 } from "cesium";
import { Viewer, Entity } from "resium";
const App = () => (
<Viewer full>
<Entity
name="Tokyo"
position={Cartesian3.fromDegrees(139.767052, 35.681167, 100)}
point={{ pixelSize: 10 }}
description="hoge"
/>
</Viewer>
);
export default hot(module)(App);
package.json
"dependencies": {
"cesium": "^1.55.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-hot-loader": "^4.8.0",
"react-scripts": "2.1.8",
"resium": "^1.3.0"
},
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
SyntaxError: return not in function - JavaScript - MDN Web Docs
The JavaScript exception "return (or yield) not in function" occurs when a return or yield statement is called outside of a function.
Read more >SyntaxError: script.js: 'return' outside of function `r` (6:4)
SyntaxError : script.js: 'return' outside of function `r` (6:4). I think I'm inputting something wrong or i got my parameters wrong?
Read more >SyntaxError: 'Return' Outside Function in Python - STechies
Syntaxerror : 'return' outside function. This syntax error is nothing but a simple indentation error, generally, this error occurs when the indent or...
Read more >Return outside function error in Python - Stack Overflow
You can only return from inside a function and not from a loop. It seems like your return should be outside the while...
Read more >[resolved] SyntaxError: 'return' statement outside of function 6/9
Can someone please tell me specifically why I am getting the message “SyntaxError: 'return' statement outside of function.” I have tried over and...
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 FreeTop 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
Top GitHub Comments
Modify
App.js
to this way, it will run normally.When I replaced it with
import { Viewer, Entity, Color } from "cesium";
, threw an error, I don’t know what happened.My App.js