-
Notifications
You must be signed in to change notification settings - Fork 263
Description
Note: If your issue/feature-request/question is regarding the AWS AppSync service, please log it in the
official AWS AppSync forum
Do you want to request a feature or report a bug?
bug
What is the current behavior?
App does not transpile properly for IE in angular 7.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
App works in IE properly when built with angular 6. After upgrade to angular 7 app does not run in IE, showing syntax errors in console. The issue applies only to IE. It works fine in Chrome and Firefox.
App works properly
in IE when built with angular 7 without AppSync
. It includes aws-amplify and aws-amplify-angular which work properly.
One symptom occurs when running the development server using ng serve
. IE throws syntax error in the console on this code:
args[0].replace(/%[a-zA-Z%]/g, match => {
Note the arrow function expression, which is not supported in IE.
A different symptom occurs when running the development server against compiled code using http-server dist/app/
. IE throws 'Expected identifier' error in console on this code:
t.log=function(...e)
Note the spread syntax, which is not supported in IE.
What is the expected behavior?
The code should be properly transpiled for IE automatically by the Angular build process but is not happening for aws-appsync under Angular 7. I found a similar issue reported in a different project, angular/angular-cli#9508, with this description of the underlying cause:
I had a look at this and from what I am seeing is that punycode as shipping only ES2015 sources. In Angular-CLI we don't perform any downleveling as we assume that the library is providing the needed sources.
I'm not saying that is the cause here but I wonder if aws-appsync is also shipping with only ES2015
sources.
Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?
Code works properly under angular 6. It fails under angular 7.
App includes polyfills for IE.
index.html includes script required by amplify for angular 6 compatibility
<!-- https://github.com/aws/aws-amplify/issues/678 fix: -->
<script>
if (global === undefined) {
var global = window;
}
</script>
App includes dom.ie.d.ts file for IE typescript compatibility:
// Required to support IE polyfills under Angular 7
interface Element {
msMatchesSelector(selectors: string): boolean;
}
App works properly with aws-appsync removed.
Code that instantiates appsync client:
this.client = new AWSAppSyncClient({
url: environment.graphqlEndpoint,
region: environment.region,
auth: {
type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
jwtToken: async () => (await Auth.currentSession()).getIdToken().getJwtToken()
},
disableOffline: true
});
Code that uses client:
this.client
.hydrated()
.then(client => {
client
.query({
query: this.gqlGetCase,
variables: {id: id}
})
.then(result => callback(result))
.catch(console.error);
});