AWS library (aws-amplify) and Frontity

This is what I faced during using Frontity. I need to integrate the form with google and Facebook authorization(aws-amplify) to the react app through Frontity UI but it is not possible to do. Because of a error while building. For some reason webpack does not accept it.

Frontity does not work with AWS library (aws-amplify)

Error: ./node_modules/graphql/index.mjs 49:0-53:205 2Can’t reexport the named export ‘BREAK’ from non EcmaScript module (only default export is available) 3

Frontity works fine with basically everything, although in this specific case it’s because the graphql package is doing something messed up with .mjs files.

The are 2 solutions to this problem:

  1. Modify webpack to also support the .mjs extension
  2. Change your imports to get the exact files instead of the global index:
// from
import { print } from 'graphql';
// to
import { print } from 'graphql/language/printer';

The first solution; no idea if this has to be done by the Frontity team, or if there’s something we can add (I recall some changes to allow custom Webpack rules).
The second solution is something you can do yourself easily, it just takes some time to find the correct locations and change all imports.

1 Like

it is not correct to modify aws library.

But you don’t have to modify the package, just the way you import the files from the package.