From 32018cdde220c9ff10ca971da1e03f94d34e5678 Mon Sep 17 00:00:00 2001 From: Vladimir Dementyev Date: Tue, 19 Feb 2019 16:20:36 -0500 Subject: [PATCH] Fix env_prefix consitency between Ruby and JS --- package/__tests__/dev_server.js | 2 +- package/dev_server.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/__tests__/dev_server.js b/package/__tests__/dev_server.js index 27a3e805f..66235737b 100644 --- a/package/__tests__/dev_server.js +++ b/package/__tests__/dev_server.js @@ -22,7 +22,7 @@ describe('DevServer', () => { test('with custom env prefix', () => { const config = require('../config') - config.dev_server.env_prefix = 'TEST_WEBPACKER_DEV_SERVER_' + config.dev_server.env_prefix = 'TEST_WEBPACKER_DEV_SERVER' process.env.NODE_ENV = 'development' process.env.RAILS_ENV = 'development' diff --git a/package/dev_server.js b/package/dev_server.js index 286a9ee03..fcff0c2be 100644 --- a/package/dev_server.js +++ b/package/dev_server.js @@ -9,10 +9,10 @@ const fetch = (key) => { const devServerConfig = config.dev_server if (devServerConfig) { - const envPrefix = config.dev_server.env_prefix || 'WEBPACKER_DEV_SERVER_' + const envPrefix = config.dev_server.env_prefix || 'WEBPACKER_DEV_SERVER' Object.keys(devServerConfig).forEach((key) => { - const envValue = fetch(`${envPrefix}${key.toUpperCase().replace(/_/g, '')}`) + const envValue = fetch(`${envPrefix}_${key.toUpperCase().replace(/_/g, '')}`) if (envValue !== undefined) devServerConfig[key] = envValue }) }