From 0800539ca86dbfae3695085b9cceff337796eec9 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Mon, 27 May 2019 08:07:57 +0200 Subject: [PATCH 1/2] Encore: configure runtime environment if not already configured --- symfony/webpack-encore-bundle/1.0/webpack.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/symfony/webpack-encore-bundle/1.0/webpack.config.js b/symfony/webpack-encore-bundle/1.0/webpack.config.js index d85c6c4f2..49d00eb70 100644 --- a/symfony/webpack-encore-bundle/1.0/webpack.config.js +++ b/symfony/webpack-encore-bundle/1.0/webpack.config.js @@ -1,5 +1,9 @@ var Encore = require('@symfony/webpack-encore'); +if (!Encore.isRuntimeEnvironmentConfigured()) { + Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev'); +} + Encore // directory where compiled assets will be stored .setOutputPath('public/build/') From 3c583b5ab3ee59bdc30565d7ab59020f516869ec Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sat, 1 Jun 2019 07:30:08 +0200 Subject: [PATCH 2/2] add a comment --- symfony/webpack-encore-bundle/1.0/webpack.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/symfony/webpack-encore-bundle/1.0/webpack.config.js b/symfony/webpack-encore-bundle/1.0/webpack.config.js index 49d00eb70..06595d37a 100644 --- a/symfony/webpack-encore-bundle/1.0/webpack.config.js +++ b/symfony/webpack-encore-bundle/1.0/webpack.config.js @@ -1,5 +1,7 @@ var Encore = require('@symfony/webpack-encore'); +// Manually configure the runtime environment if not already configured yet by the "encore" command. +// It's useful when you use tools that rely on webpack.config.js file. if (!Encore.isRuntimeEnvironmentConfigured()) { Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev'); }