about summary refs log tree commit diff
path: root/config/webpack
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-09-13 15:18:47 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-09-13 15:18:47 +0200
commit7fa4144d48c2372b73b5ece88588381aeb861948 (patch)
treebfc8dc2d07117b19347f0793b2aecf175401a4fd /config/webpack
parent011437dcb5c4719ad6627f3a4dc07a5ce1bd9db8 (diff)
Fix building assets in test environment (#8691)
Webpacker (Ruby wrapper to webpack) uses RAILS_ENV-based environments while
the javascript configuration for webpack re-reads this configuration file using
the NODE_ENV environment variable. This means that when RAILS_ENV=test, running
“assets:precompile” compiled the production packs in “public/packs” while
webpacker expects them in “public/packs-test”. This causes Ruby to recompile
them on-the-fly, possibly leading to race conditions in parallel_tests.

This changes:
- Disables on-the-fly compilation in test environment
- Changes the javascript part to read the correct environment
Diffstat (limited to 'config/webpack')
-rw-r--r--config/webpack/configuration.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/config/webpack/configuration.js b/config/webpack/configuration.js
index cf8c0c7e1..4d325a828 100644
--- a/config/webpack/configuration.js
+++ b/config/webpack/configuration.js
@@ -7,7 +7,7 @@ const { readFileSync } = require('fs');
 
 const configPath = resolve('config', 'webpacker.yml');
 const loadersDir = join(__dirname, 'loaders');
-const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV];
+const settings = safeLoad(readFileSync(configPath), 'utf8')[env.RAILS_ENV || env.NODE_ENV];
 
 const themePath = resolve('config', 'themes.yml');
 const themes = safeLoad(readFileSync(themePath), 'utf8');