Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New methods file #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

New methods file #5

wants to merge 3 commits into from

Conversation

faithege
Copy link
Owner

@faithege faithege commented Aug 22, 2020

I attempted to move the handleGet and handlePost methods to a separate JS file as I've not done this before - and then export/import them.

When I trigger the lambda I get an a Runtime syntax error in the log saying "SyntaxError: Cannot use import statement outside a module"

Are you an expert in modules at all? Googling couldn't point me in the right direction

@faithege faithege requested a review from sihil August 23, 2020 19:46
@sihil
Copy link
Collaborator

sihil commented Aug 25, 2020

Hey @faithege - I discussed this with my colleague @jonathonherbert who pointed me to this: TypeStrong/ts-node#922 (comment). It's not super clear to me whether the experimental flag needs to be enabled in order to pick up type: module from a package.json - but there is one way to find out: try it!

Failing that we'll need to fall back to using require (as we can't pass the flag to a Lambda in AWS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants