amplify-js: broken when upgrade to angular v6

Do you want to request a feature or report a bug? bug

What is the current behavior? broken with following error message

ERROR in ./node_modules/graphql/index.mjs
2:0-49 Can't reexport the named export 'graphql' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/graphql/index.mjs
2:0-49 Can't reexport the named export 'graphqlSync' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'DEFAULT_DEPRECATION_REASON' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'GraphQLBoolean' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'GraphQLDeprecatedDirective' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'GraphQLDirective' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'GraphQLEnumType' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'GraphQLFloat' from non EcmaScript module (only default export is available)
ERROR in ./node_modules/graphql/index.mjs
39:0-61:50 Can't reexport the named export 'GraphQLID' from non EcmaScript module (only default export is available)
...

Steps to reproduce:

  1. ng new test-amplify (Angular CLI: 6.0.0-rc.7)
  2. yarn add @angular/cli@next
  3. ng update @angular/cli --migrate-only --from=1.7.0
  4. ng update rxjs --force
  5. ng update @angular/core --next --force
  6. yarn add typescript@2.7.2
  7. add below to tsconfig.app.json
"compilerOptions": {
    "types" : ["node"]
}
  1. add below to tsconfig.json
"lib": [
      "es2017",
      "dom",
      "esnext.asynciterable"
    ]
  1. add below to main.ts
// ...
import Amplify from 'aws-amplify';
Amplify.configure({});
// ...
  1. ng serve

What is the expected behavior? No error

below is package.json

{
  "name": "test-amplify",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "6.0.0-rc.6",
    "@angular/common": "6.0.0-rc.6",
    "@angular/compiler": "6.0.0-rc.6",
    "@angular/core": "6.0.0-rc.6",
    "@angular/forms": "6.0.0-rc.6",
    "@angular/http": "6.0.0-rc.6",
    "@angular/platform-browser": "6.0.0-rc.6",
    "@angular/platform-browser-dynamic": "6.0.0-rc.6",
    "@angular/router": "6.0.0-rc.6",
    "apollo-boost": "^0.1.4",
    "aws-amplify": "^0.3.3",
    "aws-amplify-angular": "^0.1.0",
    "core-js": "^2.4.1",
    "graphql": "^0.13.2",
    "graphql-tag": "^2.9.1",
    "rxjs": "6.0.0",
    "rxjs-compat": "^6.0.0-rc.0",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.5.8",
    "@angular/cli": "^6.0.0-rc.7",
    "@angular/compiler-cli": "6.0.0-rc.6",
    "@angular/language-service": "6.0.0-rc.6",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "2.7.2"
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 16 (1 by maintainers)

Most upvoted comments

+1. This needs to be fixed ASAP

may i ask when will it be released?

When is this patch expected to make it into a release? Is there any way I can access it sooner?

Hi

I was able to reproduce this and I think I have a fix. Please stay tuned.

I wanted to give amplify a try but it does not work with angular v6

+1 - I got the same errors.

I think setting graphql dependency version to exactly 0.13.0 is more of a quick hacky solution rather than a proper fix. The proper fix will be done in Angular/CLI. The issue is tracked here

If release is a ways off, is there a way to get conprehensive guide to using the dev locally?

I followed the guides, but i am still having issues. No matter how i set that up i get errors, different errors different ways.

So ya, if possible, is there a comprehensive guide for getting angular setup with the github version of aws-amplify? (which i did manage to get it compiled).

I am having this same issue. I am not sure how to modify the webpack-config.js in an angular-cli project.

If anyone has any more detailed insight it would be greatly appreciated.

I’m getting the same error on a webpack powered project. I precisely don’t know what happened, but I noticed that with this tip something was changing with my TypeScript compilation. To resolve your same issue (that exact errors on browser console) I have tried this other solution and it worked. So I think that the issue is something related on how the bundler treat that .mjs extensions