You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing this error while using es6 syntax SyntaxError: Unexpected token export
Is there any way to upgrade the babel or web pack to support es6 syntax
How to reproduce the error
create a file test.js inside root folder
import axios from "axios"
const fun = function(){
// write your logic
}
export default fun;
error log
SyntaxError: Unexpected token export
[0] at Module._compile (internal/modules/cjs/loader.js:723:23)
[0] at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
[0] at Module.load (internal/modules/cjs/loader.js:653:32)
[0] at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
[0] at Function.Module._load (internal/modules/cjs/loader.js:585:3)
[0] at Module.require (internal/modules/cjs/loader.js:692:17)
[0] at require (internal/modules/cjs/helpers.js:25:18)
[0] at Object.<anonymous> (/home/mirsahib/Desktop/MERN_WS/example-create-react-app-express/routes/scraper.routes.js:2:27)
[0] at Module._compile (internal/modules/cjs/loader.js:778:30)
[0] at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
The text was updated successfully, but these errors were encountered:
Are referring to supporting ES6 server-side (Node)? There is no Babel/Webpack config server-side on the project but you can refer to other tutorials to add support for ES6 like the ones below.
I am facing this error while using es6 syntax
SyntaxError: Unexpected token export
Is there any way to upgrade the babel or web pack to support es6 syntax
How to reproduce the error
create a file
test.js
inside root foldererror log
The text was updated successfully, but these errors were encountered: