diff --git a/rollup/rollup.config.ts b/rollup/rollup.config.ts index 822ab418..127419a5 100644 --- a/rollup/rollup.config.ts +++ b/rollup/rollup.config.ts @@ -114,6 +114,7 @@ const DIST_DIR_MAIN = path.resolve(DIST_DIR, 'main') const VSCODE_SRC_DIST_DIR = path.resolve(DIST_DIR_MAIN, 'vscode', 'src') const VSCODE_DIR = path.resolve(BASE_DIR, 'vscode') const VSCODE_SRC_DIR = path.resolve(VSCODE_DIR, 'src') +const ASSETS_PATH = path.resolve(BASE_DIR, 'src/assets') const NODE_MODULES_DIR = path.resolve(BASE_DIR, 'node_modules') const MONACO_EDITOR_DIR = path.resolve(NODE_MODULES_DIR, './monaco-editor') const MONACO_EDITOR_ESM_DIR = path.resolve(MONACO_EDITOR_DIR, './esm') @@ -550,6 +551,26 @@ export default (args: Record): rollup.RollupOptions[] => { assetFileNames: 'assets/[name][extname]', format: 'esm', dir: 'dist/main', + intro (chunk) { + // Ensure that all our files start with an import to `assets.ts`, as this + // file has a side-effect (setting monacoRequire on globalThis) that needs + // to be evaluated before VSCode evaluates. Because VSCode needs this side-effect + // for its own side-effects. + if (chunk.facadeModuleId == null) { + return '' + } + + if (!chunk.facadeModuleId.startsWith(SRC_DIR)) { + return '' + } + + let relativePath = path.relative(path.dirname(chunk.facadeModuleId), ASSETS_PATH) + if (!relativePath.startsWith('.')) { + relativePath = './' + relativePath + } + + return `import "${relativePath}";\n` + }, entryFileNames: (chunkInfo) => { // Rename node_modules to external so it's not removing while publishing the package // tslib and rollup-plugin-styles and bundled diff --git a/src/missing-services.ts b/src/missing-services.ts index e2e031ca..544eb5da 100644 --- a/src/missing-services.ts +++ b/src/missing-services.ts @@ -174,8 +174,6 @@ import { ITitleService } from 'vs/workbench/services/title/common/titleService' import { IChatAgentService } from 'vs/workbench/contrib/chat/common/chatAgents' import { IActiveLanguagePackService, ILocaleService } from 'vs/workbench/services/localization/common/locale' import { joinPath } from 'vs/base/common/resources' -import { unsupported } from './tools' -import { getBuiltInExtensionTranslationsUris } from './l10n' import { IExtensionIgnoredRecommendationsService, IExtensionRecommendationsService } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations' import { IIgnoredExtensionsManagementService } from 'vs/platform/userDataSync/common/ignoredExtensions' import { IExtensionRecommendationNotificationService } from 'vs/platform/extensionRecommendations/common/extensionRecommendations' @@ -183,6 +181,8 @@ import { IWorkspaceExtensionsConfigService } from 'vs/workbench/services/extensi import { IRemoteUserDataProfilesService } from 'vs/workbench/services/userDataProfile/common/remoteUserDataProfiles' import { IExtensionBisectService } from 'vs/workbench/services/extensionManagement/browser/extensionBisect' import { IUserDataSyncAccountService } from 'vs/platform/userDataSync/common/userDataSyncAccount' +import { unsupported } from './tools' +import { getBuiltInExtensionTranslationsUris } from './l10n' class NullLoggerService extends AbstractLoggerService { constructor () {