Edge SCRIPT1028: Expected identifier, string or number
Describe the bug The react project uses the 'authenticator' to generate code errors in the Edge browser;SCRIPT1028: Expected identifier, string or number
To Reproduce Steps to reproduce the behavior: 1.Open the project introducing this otplib at Edge 2.Page white screen 3.error SCRIPT1028: Expected identifier, string or number
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Details (please provide any relevant information):
- otplib version:
- os:
- browser:
- node / yarn:
- frameworks (if any):
Additional context Add any other context about the problem here.
Acknowledged. Are you able to tell if any script fail to load?
The reason why this is happening is because the transpiler (e.g. babel) isn't checking node_modules folder, and the code is failing because of the spread operator.
node_modules/@otplib/core/index.js
class OTP {
constructor(defaultOptions = {}) {
this._defaultOptions = Object.freeze({ ...defaultOptions // <--- here
});
this._options = Object.freeze({});
}
So if you transpile the @otplib/core everything works fine.