From 2a1dd8328dce9fa9bb84cdc3eb0f874203aa3221 Mon Sep 17 00:00:00 2001 From: Cedric Sohrauer Date: Fri, 10 May 2019 15:45:11 +0200 Subject: [PATCH] Interpolate variables into template before minification Otherwise code snippets like `if (%NODE_ENV% === production)` will always be removed as %NODE_ENV% is not yet being replaced by the current environment --- packages/react-dev-utils/InterpolateHtmlPlugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-dev-utils/InterpolateHtmlPlugin.js b/packages/react-dev-utils/InterpolateHtmlPlugin.js index 30438f0b8e0..447e0ee3ea6 100644 --- a/packages/react-dev-utils/InterpolateHtmlPlugin.js +++ b/packages/react-dev-utils/InterpolateHtmlPlugin.js @@ -26,7 +26,7 @@ class InterpolateHtmlPlugin { compiler.hooks.compilation.tap('InterpolateHtmlPlugin', compilation => { this.htmlWebpackPlugin .getHooks(compilation) - .beforeEmit.tap('InterpolateHtmlPlugin', data => { + .afterTemplateExecution.tap('InterpolateHtmlPlugin', data => { // Run HTML through a series of user-specified string replacements. Object.keys(this.replacements).forEach(key => { const value = this.replacements[key];