Skip to content

Bundle extension as ESM to benefit from code splitting - #373

Merged
Brandon Waterloo (bwateratmsft) merged 1 commit into
mainfrom
bmw/esmExtension
Feb 5, 2026
Merged

Brandon Waterloo (bwateratmsft) merged 1 commit into
mainfrom
bmw/esmExtension

Conversation

@bwateratmsft

Copy link
Copy Markdown
Collaborator

Fixes #366

Comment thread package.json Resolved
@bwateratmsft
Brandon Waterloo (bwateratmsft) marked this pull request as draft February 2, 2026 21:47
@bwateratmsft

Copy link
Copy Markdown
Collaborator Author

Switching to draft...something is breaking loading

@bwateratmsft

Brandon Waterloo (bwateratmsft) commented Feb 5, 2026 •

Copy link
Copy Markdown
Collaborator Author

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR converts the extension from CommonJS to ESM (ECMAScript Modules) format to enable code splitting and improve extension loading performance, addressing issue #366 where code loading time increased in version 2.4.0.

Changes:

  • Converted main.mjs from CommonJS to ESM syntax with dynamic imports
  • Updated package.json to reference main.mjs and added module field
  • Enabled ESM bundling in esbuild configuration
  • Updated language server references to use .mjs extension

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
main.mjs Converted from CommonJS exports to ESM exports with dynamic import of extension bundle
package.json Updated main entry point to main.mjs, added module field, and upgraded vscode-azext-eng to enable ESM bundling
package-lock.json Updated lockfile to reflect vscode-azext-eng version bump to 1.0.0-alpha.12
esbuild.mjs Enabled ESM mode by passing true parameter to autoSelectEsbuildConfig
src/extension.ts Updated language server file references from server.js to server.mjs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bwateratmsft
Brandon Waterloo (bwateratmsft) merged commit 896e793 into main Feb 5, 2026
1 check passed
@bwateratmsft
Brandon Waterloo (bwateratmsft) deleted the bmw/esmExtension branch February 5, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bundle extension as ESM

3 participants