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

Add esbuild to bundle and package the extension #467

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

Conversation

ryanluker
Copy link
Owner

@ryanluker ryanluker commented Jan 29, 2025

Work

#212
Nothing too crazy here, mainly just following along with the migration guide / vscode extension development documentation.
https://code.visualstudio.com/api/working-with-extensions/bundling-extension#migrate-an-existing-extension

Tested the following areas

  • vsce package (installed and confirmed it can display coverage)
  • npm run test (seems to have issues in the github CI 😓)
  • npm run build

tested the follow areas:
1) vsce package (installed and confirmed it can display coverage)
2) npm run test
3) npm run build
@ryanluker ryanluker linked an issue Jan 29, 2025 that may be closed by this pull request
@ryanluker ryanluker added this to the 2.14.0 milestone Jan 29, 2025
@ryanluker ryanluker marked this pull request as ready for review February 12, 2025 02:56
@ryanluker
Copy link
Owner Author

ryanluker commented Feb 12, 2025

@mattseddon I came across some interesting issues with the main value from the package.json and running the test suite. I tried to change the value to "main": "./dist/extension", as per the vscode docs.

They have this snippet, where it looks like this should be the main entry for the compiled extentions?
https://code.visualstudio.com/api/working-with-extensions/bundling-extension#run-the-extension

Before you can run the extension, the main property in package.json must point to the bundle, which for the configuration above is "./dist/extension". With that change, the extension can now be executed and tested.

https://code.visualstudio.com/api/references/extension-manifest

main string The entry point to your extension.

Should I be able to add something to the mocha runTests file that allows me to use a different main value for testing vs for running / packaging? (Or maybe I am miss understanding what the main manifest value is for)

@mattseddon
Copy link
Collaborator

mattseddon commented Feb 12, 2025

@mattseddon I came across some interesting issues with the main value from the package.json and running the test suite. I tried to change the value to "main": "./dist/extension", as per the vscode docs.

They have this snippet, where it looks like this should be the main entry for the compiled extentions? https://code.visualstudio.com/api/working-with-extensions/bundling-extension#run-the-extension

Before you can run the extension, the main property in package.json must point to the bundle, which for the configuration above is "./dist/extension". With that change, the extension can now be executed and tested.

https://code.visualstudio.com/api/references/extension-manifest

main string The entry point to your extension.

Should I be able to add something to the mocha runTests file that allows me to use a different main value for testing vs for running / packaging? (Or maybe I am miss understanding what the main manifest value is for)

If you're moving the out directory to dist you'll need to repoint the test command as well: "test": "npm run compile && node ./out/test/runTest.js",

Note: Only looked at this very quickly will take a proper look later today.

@mattseddon
Copy link
Collaborator

I think my previous comment stands, if you are going to move main onto dist then all of the scripts need to point to dist, probably best to get rid of tsc based builds altogether and to use watch from esbuild.

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.

Add webpack to the build pipeline
2 participants