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

avoid loading an app that its env was not loaded yet #9194

Merged
merged 1 commit into from
Sep 14, 2024

Conversation

davidfirst
Copy link
Member

This PR fixes an issue of app data not being saved after running "create component" and then "snap" from the extension. The reason it happened is complex. It involves node.js caching package.json info and an API call of "getCompsMetadata" that was executed during the "create component" call.
Because "getCompsMetadata" gets app-data, it tries to load the apps as plugins, which makes node access its package.json. At this stage, the package.json didn't have the "type: module" yet, so node.js assumes this is a CJS file.
Later, bit re-write the package.json with the data from the env, which includes "type: module", but it's too late. Node.js already cached the package.json and refuses to see the change.

This fix block the access to the app files unless the env is fully loaded, which then we assume the package.json is correct.

@davidfirst davidfirst merged commit fc28ddb into master Sep 14, 2024
11 checks passed
@davidfirst davidfirst deleted the load-not-ready-apps branch September 14, 2024 02:04
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