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

fix: package exports for usage in plugins #1552

Closed
wants to merge 1 commit into from
Closed

fix: package exports for usage in plugins #1552

wants to merge 1 commit into from

Conversation

rubenkaiser
Copy link

@rubenkaiser rubenkaiser commented Aug 25, 2022

named export of lambda for usage in plugins like sqs-offline or eventbridge-offline

name export of lambda for usage in plugins like sqs-offline or eventbridge-offline
@rubenkaiser rubenkaiser changed the title Update index.js Exports for usage in plugins Aug 25, 2022
@rubenkaiser rubenkaiser changed the title Exports for usage in plugins WIP: Exports for usage in plugins Aug 25, 2022
@rubenkaiser rubenkaiser changed the title WIP: Exports for usage in plugins Exports for usage in plugins Aug 25, 2022
@abhijeet-toptal
Copy link

@rubenkaiser do you know when are we expecting this PR to be merged? I am blocked on using eventbridge-offline with latest version of serverless-offline. Thanks!

@rubenkaiser
Copy link
Author

I have no control over that. Hopefully it will be merged soon after which I will release a new version of serverless-offline-eventbridge and submit a PR for an update in offline-sns.

@dnalborczyk dnalborczyk changed the title Exports for usage in plugins fix: package exports for usage in plugins Aug 30, 2022
@dnalborczyk
Copy link
Collaborator

dnalborczyk commented Aug 30, 2022

thank you for the PR @rubenkaiser !

you mentioned here: rubenkaiser/serverless-offline-eventBridge#60 (comment) that other plugins (e.g. sqs?) are importing "several things". I haven't found time to look into it yet, but do you know by any chance what else is needed - other than the Lambda class?

@dnalborczyk
Copy link
Collaborator

dnalborczyk commented Aug 30, 2022

I was just digging through the node.js documentation, I'm not very familiar with the fairly new package exports myself, but it appears there might be one additional alternative: subpath exports https://nodejs.org/dist/latest-v18.x/docs/api/packages.html#subpath-exports

I wonder if we could (or even should?) do something similar mentioned here: https://nodejs.org/dist/latest-v18.x/docs/api/packages.html#extensions-in-subpaths

e.g.

import Lambda from 'serverless-offline/Lambda'

I'm contemplating a bit and I believe I'm leaning more towards that approach.

what are your opinions on this matter?

@rubenkaiser
Copy link
Author

In my test setup I first tried this approach as it seems to be the nicest solution. For some reason I kept getting errors importing the submodules. Not sure why. I will have another look somewhere next week.

@dnalborczyk
Copy link
Collaborator

dnalborczyk commented Sep 2, 2022

@rubenkaiser could you have a look if this would work for you: #1552

@dnalborczyk
Copy link
Collaborator

dnalborczyk commented Sep 2, 2022

@rubenkaiser sorry, linked to your own PR 🤦 😄

I meant this one: #1561

@dnalborczyk
Copy link
Collaborator

super seeded by: #1561

@dnalborczyk dnalborczyk closed this Sep 3, 2022
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.

3 participants