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: rebuild @devfile/api dependency to fix che-in-che development #472

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

vitaliy-guliy
Copy link
Contributor

@vitaliy-guliy vitaliy-guliy commented Dec 20, 2024

What does this PR do?

Re-compiles @devfile/api node package on its place inside node_modules/@devfile/api directory to have a library with type commonjs instead of module.

Since the type of @devfile/api node package has been changed from commonjs to module, it become not possible anymore to use import from VS Code when we compile it inside the workspace and then launch a secondary editor instance.

The @devfile/api version we are currently using can be found here https://www.npmjs.com/package/@devfile/api/v/2.3.0-1723034342?activeTab=code
It it possible to open packge.json and check for type property.

The version we used before is https://www.npmjs.com/package/@devfile/api/v/2.2.1-alpha-1667236163?activeTab=code
There is no type property in the package.json file, so default commonjs value is used.

Why do we have the issue when compile and run the editor in the development mode only?

Normally, the webpack is used to create the editor bundle, and instead of having a dozen of separate javascript file, we have only one weight, obfuscated javascript file which speeds up the process of downloading the script in the browser.

When we compile che-code in the development mode, the compiler creates thousands of seprarate javascript files and then when we run the backend with node, we face the restriction with the incompatibility of types (vscode is compiled as commonjs).

The changes provided by this pull request will be used only when che-code dogfooding.

Screenshot from 2024-12-20 19-55-42

What issues does this PR fix?

eclipse-che/che#23163

How to test this PR?

  • create a workspace from this the branch https://github.com/che-incubator/che-code/tree/recompile-devfile-api

  • run devfile: Run VS Code server on port 8000 command. When the command is being executed, it is possible to check the output and see which @devfile/api packages have been recompiled.

  • run devfile: Compile with npm command

  • run devfile: Run VS Code server on port 8000 command and open the secondary editor in a separate window

  • once the editor is opened, ensure there are no error notifications appeared

Does this PR contain changes that override default upstream Code-OSS behavior?

  • the PR contains changes in the code folder (you can skip it if your changes are placed in a che extension )
  • the corresponding items were added to the CHANGELOG.md file
  • rules for automatic git rebase were added to the .rebase folder

Signed-off-by: vitaliy-guliy <vgulyy@redhat.com>
Copy link

github-actions bot commented Dec 20, 2024

Click here to review and test in web IDE: Contribute

Signed-off-by: vitaliy-guliy <vgulyy@redhat.com>
Signed-off-by: vitaliy-guliy <vgulyy@redhat.com>
Signed-off-by: vitaliy-guliy <vgulyy@redhat.com>
@vitaliy-guliy vitaliy-guliy added the made-with-che Changes made with Che-Code label Dec 20, 2024
Signed-off-by: vitaliy-guliy <vgulyy@redhat.com>
Copy link

@vitaliy-guliy vitaliy-guliy changed the title fix: rebuild @devfile/api dependency to allow che-in-che development fix: rebuild @devfile/api dependency to fix che-in-che development Dec 20, 2024
@vitaliy-guliy vitaliy-guliy marked this pull request as ready for review December 23, 2024 10:30
@vitaliy-guliy
Copy link
Contributor Author

vitaliy-guliy commented Dec 23, 2024

I think it is better to port changes directly to @devfile/api.
A proposed pull request devfile/api#1666

It is possible manually download the script to the project and launch it after installing node dependencies
https://github.com/che-incubator/che-code/blob/recompile-devfile-api/recompile-%40devfile-api.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
made-with-che Changes made with Che-Code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant