otplib icon indicating copy to clipboard operation
otplib copied to clipboard

Edge SCRIPT1028: Expected identifier, string or number

Open liyihan940121 opened this issue 5 years ago • 2 comments

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.

liyihan940121 avatar May 29 '20 16:05 liyihan940121

Acknowledged. Are you able to tell if any script fail to load?

yeojz avatar Jul 10 '20 11:07 yeojz

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.

crazyLjuba avatar Sep 17 '20 11:09 crazyLjuba