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

Webpack does not generate feedback when the backend component is bundled #12899

Closed
meisenbarth-work opened this issue Sep 12, 2023 · 6 comments · Fixed by #12902
Closed

Webpack does not generate feedback when the backend component is bundled #12899

meisenbarth-work opened this issue Sep 12, 2023 · 6 comments · Fixed by #12902
Labels
bundle Related to webpack bundling

Comments

@meisenbarth-work
Copy link

Bug Description:

I've updated my project to use Theia 1.40.1 and enabled to bundling of the backend server (by deleting and letting theia regenerate webpack.config.js), now Webpack does not generate feedback messages anymore.

Steps to Reproduce:

  1. Update Theia in your project to 1.40.1
  2. Build your project -> Build-Feedback is generated
  3. Regenerate the webpack.config.js (or update it manually) to enable backend bundling
  4. Build your project -> Build-Feedback is not generated

Additional Information

I've updated all dependencies to the latest version using yarn upgrade to ensure it is not due to an old version in my setup.

When I disable the bundling by commenting out nodeConfig.config in the modules.exports array feedback is again generated, but I get the warning 'require function is used in a way in which dependencies cannot be statically extracted' (which should be suppressed according to gen-webpack.config.js)

  • Operating System: Windows 10
  • Theia Version: 1.40.1
@msujew
Copy link
Member

msujew commented Sep 12, 2023

I'm aware of this issue, but I have no idea why it occurs. There's nothing in the backend build step that "suppresses" the output - it just doesn't appear. Note that errors - if there are any - still appear. But in case of success, webpack prints nothing.

@msujew msujew added the bundle Related to webpack bundling label Sep 12, 2023
@meisenbarth-work
Copy link
Author

I did some test, maybe that can help you pinpoint the issue.

When I try to include a file that does not exist in frontend bundle (import 'should-fail.css'; in ...frontend-module.ts) Webpack stays silent.
When I try to include the same file in backend bundle Webpack stays silent.
When I forcefully remove the native-webpack-plugin in my webpack.config.js (nodeConfig.config.plugins = nodeConfig.config.plugins?.filter((p) => p !== nodeConfig.nativePlugin);) build fails with missing modules (as expected) and the warnings are reported for frontend and backend.

Then I've tried to disable parts of the native-webpack-plugin. As soon as compiler.hooks.afterEmit.tapAsync is called (even with an empty function as handler) Webpack stops generating messages.

@msujew
Copy link
Member

msujew commented Sep 13, 2023

Then I've tried to disable parts of the native-webpack-plugin. As soon as compiler.hooks.afterEmit.tapAsync is called (even with an empty function as handler) Webpack stops generating messages.

Ha, that's pretty useful info, thanks! I'll see whether I can use another compiler hook to achieve the same behavior 👍

@meisenbarth-work
Copy link
Author

meisenbarth-work commented Sep 13, 2023

That may not be needed, I've been tempering with the resulting js file of the plugin and when I change the result to:

    compiler.hooks.afterEmit.tapAsync(NativeWebpackPlugin.name, async (compilation, callback) => {
        await this.copyTrashHelper(compiler);
        if (this.options.ripgrep) {
            await this.copyRipgrep(compiler);
        }
        if (this.options.pty) {
            await this.copyNodePtySpawnHelper(compiler);
        }
        this.tracker.cleanupSync();

        callback();
    });

I get messages again (the callback parameter and the call of callback as last line).

Edit: This is probably not be the solution, I get missing files when I try to compile.

@msujew
Copy link
Member

msujew commented Sep 13, 2023

@meisenbarth-work Using tapPromise instead of tapAsync did the trick (because who needs naming conventions?). See #12902.

@meisenbarth-work
Copy link
Author

Works for me, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bundle Related to webpack bundling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants