I am facing this issue from last day.. No solution for this error Complete error log is mentioned below
var v3Err;
try {
module.exports = require("chokidar");
return;
} catch(e) {
v3Err = e;
}
Error occurs in 'return' outside of function (4:2)
SyntaxError: E:\test\node_modules\watchpack\lib\chokidar.js: 'return' outside of function (4:2)
at Object._raise (E:\test\node_modules@babel\parser\src\parser\error.js:60:45)
at Object.raiseWithData (E:\test\node_modules@babel\parser\src\parser\error.js:55:17)
at Object.raise (E:\test\node_modules@babel\parser\src\parser\error.js:39:17)
at Object.parseReturnStatement (E:\test\node_modules@babel\parser\src\parser\statement.js:563:12)
at Object.parseStatementContent (E:\test\node_modules@babel\parser\src\parser\statement.js:197:21)
at Object.parseStatement (E:\test\node_modules@babel\parser\src\parser\statement.js:151:17)
at Object.parseBlockOrModuleBlockBody (E:\test\node_modules@babel\parser\src\parser\statement.js:873:25)
at Object.parseBlockBody (E:\test\node_modules@babel\parser\src\parser\statement.js:843:10)
at Object.parseBlock (E:\test\node_modules@babel\parser\src\parser\statement.js:813:10)
at Object.parseStatementContent (E:\test\node_modules@babel\parser\src\parser\statement.js:218:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: pawjs --no-cache --config=./pawconfig.json --env=development start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\glowlogix\AppData\Roaming\npm-cache_logs\2020-08-17T09_19_41_742Z-debug.log
Because Node.js uses CommonJS syntax (require syntax) to import other modules/functions. Whereas, the import syntax is called ES modules, which is a standard in JavaScript. Now we understand the issue, let's see how to fix it.
In order to use Webpack with ReactJS.NET's server-side rendering, it is suggested that you create a separate bundle ("entry point") containing only the code required to perform server-side rendering. Any components you would like to render server-side must be exposed globally so that ReactJS.NET can access them.
Webpack is the recommended bundling solution and should be preferred over Cassette or ASP.NET Bundling. Your project will bundle its own copy of react and react-dom with webpack, and ReactJS.NET will be used only for server-side rendering.
A full example is available in the ReactJS.NET repository. An asset manifest is generated by the webpack-asset-manifest plugin, written to asset-manifest.json. See the webpack config example above for details on how to set this up. This manifest file contains a list of all of the bundles required to run your app.
I was facing the same problem in my project. An autocomplete (due to a typo) automatically added an import to my file. When i removed it my problem was solved. So i advice you to check your modules for unnecessary imports.
example of my auto added import
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With