diff --git a/CHANGELOG.md b/CHANGELOG.md index 4940d003374e8..bd0d3a75e9c1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ## v1.42.0 - [core] fixed logger level propagation when log config file changes at runtime [#12566](https://github.com/eclipse-theia/theia/pull/12566) - Contributed on behalf of STMicroelectronics +- [dev-packages] restore src-gen frontend production behavior [12950](https://github.com/eclipse-theia/theia/pull/12950) - Contributed on behalf of STMicroelectronics - [vscode] stub TestController invalidateTestResults [#12944](https://github.com/eclipse-theia/theia/pull/12944) - Contributed by STMicroelectronics - [vscode] support iconPath in QuickPickItem [#12945](https://github.com/eclipse-theia/theia/pull/12945) - Contributed by STMicroelectronics - [vsx-registry] added a hint to extension fetching ENOTFOUND errors [#12858](https://github.com/eclipse-theia/theia/pull/12858) - Contributed by STMicroelectronics diff --git a/dev-packages/application-manager/src/generator/frontend-generator.ts b/dev-packages/application-manager/src/generator/frontend-generator.ts index 59cccab6e37b7..a3011ee8a7baf 100644 --- a/dev-packages/application-manager/src/generator/frontend-generator.ts +++ b/dev-packages/application-manager/src/generator/frontend-generator.ts @@ -97,7 +97,7 @@ async function preload(parent) { container.parent = parent; try { ${Array.from(frontendPreloadModules.values(), jsModulePath => `\ - await load(container, import('${jsModulePath}'));`).join(EOL)} + await load(container, ${this.importOrRequire()}('${jsModulePath}'));`).join(EOL)} const { Preloader } = require('@theia/core/lib/browser/preload/preloader'); const preloader = container.get(Preloader); await preloader.initialize(); @@ -125,9 +125,9 @@ module.exports = (async () => { try { ${Array.from(frontendModules.values(), jsModulePath => `\ - await load(container, import('${jsModulePath}'));`).join(EOL)} + await load(container, ${this.importOrRequire()}('${jsModulePath}'));`).join(EOL)} await start(); - } catch (reason) { + } catch (reason) {i console.error('Failed to start the frontend application.'); if (reason) { console.error(reason); @@ -142,6 +142,10 @@ ${Array.from(frontendModules.values(), jsModulePath => `\ `; } + protected importOrRequire(): string { + return this.options.mode !== 'production' ? 'require' : 'require'; + } + /** HTML for secondary windows that contain an extracted widget. */ protected compileSecondaryWindowHtml(): string { return `