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

update to work with Webpack 5 #152

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,31 +100,29 @@ class Jarvis {
bootJarvis();
}

compiler.plugin("watch-run", (c, done) => {
compiler.hooks.watchRun.tap("Jarvis", (c, done) => {

Choose a reason for hiding this comment

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

You should leave 'done' and 'done()' (in the next) in webpack5

compiler.hooks.watchRun.tap("Jarvis", (c) => {

image

if (this.options.watchOnly) {
bootJarvis();
}
this.env.watching = true;
done();
});

compiler.plugin("run", (c, done) => {
compiler.hooks.run.tap("Jarvis", (c, done) => {
this.env.watching = false;
done();
});

// report the webpack compiler progress
compiler.apply(
new webpack.ProgressPlugin((percentage, message) => {
this.reports.progress = { percentage, message };
if (this.env.running) {
jarvis.io.emit("progress", { percentage, message });
}
})
);
new webpack.ProgressPlugin((percentage, message) => {
this.reports.progress = { percentage, message };
if (this.env.running) {
jarvis.io.emit("progress", { percentage, message });
}
}).apply(compiler);

// extract the final reports from the stats!
compiler.plugin("done", stats => {
compiler.hooks.run.tap("Jarvis", stats => {

Choose a reason for hiding this comment

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

should be
compiler.hooks.done.tap("Jarvis"

if (!this.env.running) return;

const jsonStats = stats.toJson({ chunkModules: true });
Expand Down
2 changes: 1 addition & 1 deletion src/server/reporter-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function configAnalyser(configs) {
function _formattedError(errors = []) {
const newFormat = { newline: true, escapeXML: true };
const formatter = new Formatter(newFormat);
return errors.map(error => formatter.toHtml(error));
return errors.map(error => formatter.toHtml(error.message || ''));
}

const successFooter = `<div class="stats-success-footer">
Expand Down