"node": "14.16.0",
"npm": "6.14.11"
I have 3 js files,
dev.js
const keys = {
googleClientID: 'creds',
googleClientSecret: 'creds',
mongoURI: 'creds',
cookieKey: 'creds'
}
export { keys };
prod.js
const pKeys = {
googleClientID: process.env.GOOGLE_CLIENT_ID,
googleClientSecret: process.env.GOOGLE_CLIENT_SECRET,
mongoURI: process.env.MONGO_URI,
cookieKey: process.env.COOKIE_KEY
}
export { pkeys };
key.js
if(process.env.NODE_ENV === 'production'){
export { pKeys } from './prod.js'
} else{
export { keys } from './dev.js';
}
when I do this i am getting this error:
file:///home/vaibhav/Documents/email-app/email-server/config/key.js:2
export { pKeys } from './prod.js'
^^^^^^
SyntaxError: Unexpected token 'export'
where am I going wrong? because according to this doc by MDN if you go down to examples and 'export from' I did the same thing. Do let me know if I need to provide any other information, because i am not very strong at javascrpt. Also inside package.json i have set:
"type": "module"