0

my website works fine in Chrome and Firefox but not on edge.

The website is not loading correctly and i got this message :

SCRIPT1028: SCRIPT1028: Expected identifier, string or number index.js (6199,13)

This refers to config.js:

const appName = 'mywebsite';
const databaseName = 'databaseName';
const serverPort = process.env.PORT || 3122;


const apiUrl = "/";

const source=require("./client_id.json")

const completeConfig = {

    default: {

        appName,
        serverPort,
        apiUrl,
        databaseUrl: process.env.MONGODB_URI || `mongodb://localhost/${databaseName}`,
        jsonOptions: {
            headers: {
                'Content-Type': 'application/json'
            }
        }
    },

    development: {
        appUrl: `http://localhost:${serverPort}`
    },

    production: {
    appUrl: `http://localhost:${serverPort}`
    }

}

const mailConfig = {
  user: "user@user.fr",
  clientId: source.web.client_id,
  clientSecret: source.web.client_secret,
  refreshToken: 'refreshToken',
  accessToken: 'accessToken'
}


module.exports = {
    config: { ...completeConfig.default, ...completeConfig[process.env.NODE_ENV] },
    completeConfig,
    mailConfig,
}

specially this parts :

module.exports = {
    config: { ...completeConfig.default, ...completeConfig[process.env.NODE_ENV] },
    completeConfig,
    mailConfig,
}

Here is the debog console from edge : image

Can someone help me ?

NyanKo
  • 1
  • Which version of edge are you using? It seems the spread operator is not supported in the one you're using. https://caniuse.com/#search=spread%20operator – rlecaro2 Mar 03 '20 at 18:51
  • @rlecaro2 You right my version of edge is deprecated to use spread operator ! i update edge and now it's working thank you ! – NyanKo Mar 04 '20 at 09:14

1 Answers1

0

The misplaced comma at the end of your module.exports object could be the reason of this strange behavior.

Try with the following code:

module.exports = {
    config: { ...completeConfig.default, ...completeConfig[process.env.NODE_ENV] },
    completeConfig,
    mailConfig // Just removing the comma here
}

For more information about this error, see Possible cases for Javascript error: "Expected identifier, string or number"

KNMRIZNM
  • 11
  • 1