question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available) when including aws-amplify - lack of mjs file support

See original GitHub issue

Current behavior:

Have just upgraded to version 5.0.0 and it looks like there is a webpack config issue, missing *.mjs support, which is causing the @aws-amplify and graphql libraries from compiling. This worked in 4.12.1

aws-amplify/amplify-js#4299 graphql/graphql-js#1272

Error: Webpack Compilation Error
./node_modules/graphql/index.mjs 49:0-53:205
Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available)
 @ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js
 @ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js
 @ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js
 @ ./node_modules/aws-amplify/lib-esm/index.js
 @ ./cypress/support/custom/userLogin.ts
 @ ./cypress/support/custom/index.ts
 @ ./cypress/support/commands.ts
 @ ./cypress/support/index.ts

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
DaveClissoldcommented, Aug 24, 2020

@jennifer-shehane I have a custom function to login to the AWS Cognito service, which uses the aws-amplify library.

import Amplify, { Auth } from 'aws-amplify';


Amplify.configure({
  Auth: {
    region: Cypress.env('AWS_REGION'),
    userPoolId: Cypress.env('AWS_USERPOOLID'),
    userPoolWebClientId: Cypress.env('AWS_USERPOOLWEBCLIENTID'),
  }
})

export const awsLogin = async () => {
  const username = Cypress.env('TEST_USERNAME');
  const password = Cypress.env('TEST_PASSWORD')
  try
    {
      const user = await Auth.signIn(username, password);
      return user
    } 
  catch (error)
    {
      console.log('error signing in', error);
    }
}

Aws-amplify relies on graphql queries, whose library ‘very kindly’ uses .mjs files.

I get the error when launching the test. It fails during the loading of the test

1reaction
jennifer-shehanecommented, Aug 24, 2020

I can recreate the error when including aws-amplify:

Repro

cypress/support/index.js

import Amplify from 'aws-amplify'

package.json

{
  "devDependencies": {
    "aws-amplify": "^3.0.24",
    "cypress": "5.0.0"
  }
}

4.12.1

The aws-amplify takes a really long time to load normally. see https://github.com/cypress-io/cypress/issues/7464

Screen Shot 2020-08-24 at 4 23 48 PM

5.0.0

Screen Shot 2020-08-24 at 4 21 06 PM
Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-amplify | Can't reexport the named export 'package_name ...
After doing some research on the issue, I found a solution that recommended to add the '. mjs' extension to the webpack. js...
Read more >
GraphQL Errors: Can't reexport the named export 'BREAK ...
GraphQL Errors: Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available).
Read more >
Changelog - esbuild - Breword 文档集合
The CSS bundler built in to esbuild is only designed with real CSS in mind. ... If the file "y" is in ESM...
Read more >
Changelog | Meteor API Docs
ECMAScript module syntax ( import , export , and dynamic import() ) is now supported by default everywhere, including in modules imported from...
Read more >
Export Amplify backends to CDK and use with existing ... - AWS
Today, AWS Amplify announces the ability to export Amplify CLI-generated backends as a Cloud Development Kit (CDK) stack and incorporate ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found