Skip to content

Commit 61d91f5

Browse files
committed
Improvement: Ensure respect for --no-deprecation flag when adding non util.depracation warnings to console output
1 parent 3526dda commit 61d91f5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Compiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class Compiler extends Tapable {
189189
let deprecationReported = false;
190190
this.parser = {
191191
plugin: (hook, fn) => {
192-
if(!deprecationReported) {
192+
if(!deprecationReported && process.noDeprecation !== true) {
193193
console.warn("webpack: Using compiler.parser is deprecated.\n" +
194194
"Use compiler.plugin(\"compilation\", function(compilation, data) {\n data.normalModuleFactory.plugin(\"parser\", function(parser, options) { parser.plugin(/* ... */); });\n}); instead. " +
195195
"It was called " + new Error().stack.split("\n")[2].trim() + ".");
@@ -203,7 +203,7 @@ class Compiler extends Tapable {
203203
},
204204
apply: () => {
205205
const args = arguments;
206-
if(!deprecationReported) {
206+
if(!deprecationReported && process.noDeprecation !== true) {
207207
console.warn("webpack: Using compiler.parser is deprecated.\n" +
208208
"Use compiler.plugin(\"compilation\", function(compilation, data) {\n data.normalModuleFactory.plugin(\"parser\", function(parser, options) { parser.apply(/* ... */); });\n}); instead. " +
209209
"It was called " + new Error().stack.split("\n")[2].trim() + ".");

lib/NoErrorsPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let deprecationReported = false;
99
class NoErrorsPlugin {
1010
apply(compiler) {
1111
compiler.plugin("should-emit", (compilation) => {
12-
if(!deprecationReported) {
12+
if(!deprecationReported && process.noDeprecation !== true) {
1313
compilation.warnings.push("webpack: Using NoErrorsPlugin is deprecated.\n" +
1414
"Use NoEmitOnErrorsPlugin instead.\n");
1515
deprecationReported = true;

0 commit comments

Comments
 (0)