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(gasket-plugin-command): ESM JSON imports #848

Closed
wants to merge 1 commit into from

Conversation

aryasaatvik
Copy link
Contributor

@aryasaatvik aryasaatvik commented Aug 15, 2024

Summary

I tried deploying gasket to AWS Lambda using SST and open-next. I got an error with the createRequire import

2024-08-15T00:10:17.547Z	fd062990-0d21-4422-ac69-ef5b40275d49	ERROR	 ⨯ Error: Cannot find module '../package.json'
Require stack:
- ...../gasket-serverless/node_modules/@gasket/plugin-command/lib/create.js

The import.meta.url is a part of the bundle

.next/server/chunks before
(0,a.createRequire)("file:///...../gasket-serverless/node_modules/@gasket/plugin-command/lib/create.js")("../package.json"),{

.next/server/chunks after
JSON.parse('{"name":"@gasket/plugin-command","version":"7.0.0-next. ....

I know import assertions are experimental currently but wanted to get some thoughts on it.

gasket-serverless repo is here https://github.com/aryasaatvik/gasket-serverless. deployed https://d1nb6js3qoug11.cloudfront.net/

Changelog

Test Plan

@aryasaatvik aryasaatvik requested a review from a team as a code owner August 15, 2024 00:33
@agerard-godaddy
Copy link
Contributor

Yea, this is an experimental feature that is still in a state of flux. For example, assert is now with in node@22 (docs). We can't accept this in the core plugin. Have you explored some other options or investigated why createRequire, which has been stable in node@20 (LTS docs), does not work in this deployment context?

@agerard-godaddy
Copy link
Contributor

Cannot accept this currently experimental feature.

@aryasaatvik
Copy link
Contributor Author

its stable now #1021

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