Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
741 views
in Technique[技术] by (71.8m points)

aws amplify - Can I have any way to import module about aws-export.js?

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?

question from:https://stackoverflow.com/questions/66046539/can-i-have-any-way-to-import-module-about-aws-export-js

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...