diff --git a/esbuild.mjs b/esbuild.mjs index 1d7ff88f..a3abf8bc 100644 --- a/esbuild.mjs +++ b/esbuild.mjs @@ -5,7 +5,7 @@ import { autoEsbuildOrWatch, autoSelectEsbuildConfig } from '@microsoft/vscode-azext-eng/esbuild'; -const { extensionConfig, telemetryConfig } = autoSelectEsbuildConfig(); +const { extensionConfig, telemetryConfig } = autoSelectEsbuildConfig(true); /** @type {import('esbuild').BuildOptions} */ const finalConfig = { diff --git a/main.js b/main.mjs similarity index 62% rename from main.js rename to main.mjs index 04025c44..5f35698c 100644 --- a/main.js +++ b/main.mjs @@ -3,10 +3,6 @@ * Licensed under the MIT License. See LICENSE.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ -"use strict"; - -/* eslint-disable no-undef */ // Ignore the fact that the engine (which is VSCode) is unknown by the linter - // This is the extension entrypoint, which imports extension.bundle.js, the actual extension code. // // This is in a separate file so we can properly measure extension.bundle.js load time. @@ -16,22 +12,14 @@ const perfStats = { loadEndTime: undefined }; -Object.defineProperty(exports, "__esModule", { value: true }); - -// eslint-disable-next-line @typescript-eslint/no-var-requires -const extension = require("./dist/extension.bundle"); +const extension = await import("./dist/extension.bundle.js"); -async function activate(ctx) { +export async function activate(ctx) { return await extension.activateInternal(ctx, perfStats); } -async function deactivate(ctx) { +export async function deactivate(ctx) { return await extension.deactivateInternal(ctx); } -exports.activate = activate; -exports.deactivate = deactivate; - perfStats.loadEndTime = Date.now(); - -/* eslint-enable no-undef */ diff --git a/package.json b/package.json index 2c207c1a..fa8c0fd9 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "onLanguage:dockerfile", "onLanguage:dockercompose" ], - "main": "main", + "main": "main.mjs", + "module": "main.mjs", "contributes": { "menus": { "commandPalette": [