6

Now I'm trying to import aws-exports.js which amplify-js automatically generates in node es6 type code.

my code like this. ex:something.mjs

#!/usr/bin/env node

import awsmobile from '../src/aws-exports.js';

something ....

and I try to execute under bellow

# ./something.mjs

export default awsmobile;
^^^^^^

SyntaxError: Unexpected token 'export'

then, the above error will be output.

I wonder, the aws-exports.js generated by amplify-js is in es6 format, but the extension is js. Is this the only way to execute it by writing "module" as the "type" field of package.json?

2 Answers 2

0

Changing file to .ts worked for me.

0

deleting the aws-exports.js file and then running "amplify configure project" worked for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.