Skip to content

feat: plugin support#5650

Draft
bjohansebas wants to merge 8 commits intonextfrom
plugin-support
Draft

feat: plugin support#5650
bjohansebas wants to merge 8 commits intonextfrom
plugin-support

Conversation

@bjohansebas
Copy link
Copy Markdown
Member

Summary

What kind of change does this PR introduce?

Did you add tests for your changes?

Does this PR introduce a breaking change?

If relevant, what needs to be documented once your changes are merged or what have you already documented?

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.78%. Comparing base (d163488) to head (9890a76).

❗ There is a different number of reports uploaded between BASE (d163488) and HEAD (9890a76). Click for more details.

HEAD has 19 uploads less than BASE
Flag BASE (d163488) HEAD (9890a76)
47 28
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5650      +/-   ##
==========================================
- Coverage   83.57%   76.78%   -6.79%     
==========================================
  Files          11       11              
  Lines        1924     1943      +19     
  Branches      707      712       +5     
==========================================
- Hits         1608     1492     -116     
- Misses        283      388     +105     
- Partials       33       63      +30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alexander-akait
Copy link
Copy Markdown
Member

We should start it in webpack-dev-middleware, currently webpack-dev-middleware uses console.log to output stats, it means we will spam logs, we need an options or another function wrapper - require("webpack-dev-middleware").plugin(options)

*/
setupProgressPlugin() {
// In the case where there is no compiler and it’s not being used as a plugin.
if (this.compiler === undefined) return;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ideally we should always have compiler here, so we can use /* {Compiler} */ (this.compiler) to say typescript we have it is


let started = false;

this.compiler.hooks.watchRun.tapPromise(pluginName, async () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should use another hook here, we should:

  1. Start dev server after the first compilation happend
  2. We should use hook when CleanPlugin will remove old files and webpack will not write new files, why? Because we are using memory fs here, old assets should be removed and new assets should be written to memory

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I’m going to use the afterEmit hook

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@bjohansebas let's also add a test case with output.clean: true to ensure we work as expected

await new Promise((resolve) => {
compiler.close(resolve);
});
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's add full plugin tests, where dev server plugin is a part of plugins in webpack.config.js, also let's add a test case for clean: true, these tests not fully test our plugin logic, also in future we will need to rewrite all our tests to the plugin support (not in this pr, but for future), so let's start is here (and if we need required helpers)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants