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

application-manager: fix expose-loader #10845

Merged
merged 1 commit into from
Mar 7, 2022

Conversation

paul-marechal
Copy link
Member

For some reason the loader causes some applications to fail at runtime.

Use an alternative writing for one of the injected string of code.

How to test

Should fix the browser application start failure for this repository:

https://github.com/theia-ide/theia-trace-extension/tree/b4855ec742015d08bbec0d3d549b83eb61df8ec5

Linux-only:

  • Clone the repo.
  • Run yarn.
  • Run yarn download:server
  • Run yarn --cwd examples/browser start
  • Open your browser at localhost:3000, it should fail because of some ReferenceError: global.
  • Edit node_modules/@theia/application-manager/lib/expose-loader.js and replace the same string as this PR.
  • Run yarn --cwd examples/browser
  • Run yarn --cwd examples/browser start
  • Open your browser at localhost:3000, it should work.

Review checklist

Reminder for reviewers

For some reason the loader causes some applications to fail at runtime.

Use an alternative writing for one of the injected string of code.
@paul-marechal paul-marechal added the bug bugs found in the application label Mar 4, 2022
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

I confirmed the error on master using the trace extension, and confirmed that this pull-request correctly fixes the problem:

trace-global-error

Note that in order to produce the error on the trace extension the webpack.config.js was modified to:

/**
 * This file can be edited to customize webpack configuration.
 * To reset delete this file and rerun theia build again.
 */
// @ts-check
const config = require('./gen-webpack.config.js');

/**
 * Expose bundled modules on window.theia.moduleName namespace, e.g.
 * window['theia']['@theia/core/lib/common/uri'].
 * Such syntax can be used by external code, for instance, for testing.
 * */
config.module.rules.push({
    test: /\.js$/,
    loader: require.resolve('@theia/application-manager/lib/expose-loader')
});

module.exports = config;

@paul-marechal paul-marechal merged commit 356c7cf into master Mar 7, 2022
@paul-marechal paul-marechal deleted the expose-loader-global-fix branch March 7, 2022 15:50
@github-actions github-actions bot added this to the 1.24.0 milestone Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants