Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MS Edge fails with SCRIPT1028: Expected identifier, string or number #3339

Closed
szellcsaba-ge opened this issue Feb 22, 2018 · 9 comments
Closed

Comments

@szellcsaba-ge
Copy link

RxJS version:
5.5.6

Code to reproduce:
N/A, we have a complicated build process, can't strip out the code to repro.
Angular5, webpack, Polymer, etc.

Expected behavior:
RxJS should work in MS Edge

Actual behavior:
SCRIPT1028: Expected identifier, string or number
App fails to render anything, blank page.

Additional information:
After a short investigation, the problem is on this line (marked with * the exact position):

const { request, request: { user, method, url, async*, password, headers, body } } = this;

This line is the part of the AjaxSubscriber class' send() method.

If I replace the 'async' variable names in the method for eg. 'asynch', everything starts to work without any problem.

@kwonoj
Copy link
Member

kwonoj commented Feb 22, 2018

With this issue without isolation in build steps, I have suspect this is related to your build configurations.

Specific code line you mentioned is simply transpiled down into like below: (CJS, umd both)

AjaxSubscriber.prototype.send = function () {
        var _a = this, request = _a.request, _b = _a.request, ..... async = _b.async, password = _b.password, headers = _b.headers, body = _b.body;

while having var async = ${something} isn't great practices, it doesn't have conflict to global scope async keyword at least afaik.

If you can't strip out code, what happens if you import bare rx without involving anything in Edge? (no angular, no polymer, etcs)

@kwonoj
Copy link
Member

kwonoj commented Feb 22, 2018

Also may worth to check http://reactivex.io/rxjs/ (it loads umd build of Rx inside) on Edge to see global build fails with same transpiled results. (it did work on me).

@szellcsaba-ge
Copy link
Author

The code looks like this:

class AjaxSubscriber extends __WEBPACK_IMPORTED_MODULE_4__Subscriber__["a" /* Subscriber */] {
    constructor(destination, request) {
        ....
    }
    next(e) {
        ....
    }
    send() {
        const { request, request: { user, method, url, asynch, password, headers, body } } = this;

@szellcsaba-ge
Copy link
Author

Downgrading the transpile to es5 works around the problem.

@kwonoj
Copy link
Member

kwonoj commented Mar 1, 2018

I'm feeling it'd better to rename variable name in further eventually, for cases if we have runtime doesn't need any transpilation one day.

@sdunst
Copy link

sdunst commented May 15, 2018

Problem still occurs in RxJS 6.1.0
We updated together with Angular. Production build is fine because uf uglyfication, but for the development it is a problem... We don't really want to transpile to es5 (but for now it is our workaround)

@sbradl
Copy link

sbradl commented Jun 19, 2018

Just run at this problem too. For me fromPromise causes this error.

@marsc
Copy link

marsc commented Jun 14, 2019

Ran into this problem with Angular 8 and Edge. Same code piece as above.

@kwonoj
Copy link
Member

kwonoj commented Jan 22, 2021

Since old EDGE itself is deprecated, closing issue and recommend to use latest rxjs & support chromium based edge.

@kwonoj kwonoj closed this as completed Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants