From 4b6b103683008e8f27f9fc9c04ba14ae41a77004 Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Fri, 22 Apr 2022 17:32:30 +0100 Subject: [PATCH] re-export configModule to reduce duplication and fix dynamic config --- addon/index.js | 12 +++--------- index.js | 8 ++------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/addon/index.js b/addon/index.js index d96853b..90885f3 100644 --- a/addon/index.js +++ b/addon/index.js @@ -1,11 +1,5 @@ -import { isTesting, macroCondition, getOwnConfig } from '@embroider/macros'; +import { getOwnConfig, importSync } from '@embroider/macros'; -let config; +let configModulePath = `${getOwnConfig().modulePrefix}/config/environment`; -if (macroCondition(isTesting())) { - config = getOwnConfig().testConfig; -} else { - config = getOwnConfig().config; -} - -export default config; +export default importSync(configModulePath).default; diff --git a/index.js b/index.js index 292757b..ff7efa0 100644 --- a/index.js +++ b/index.js @@ -28,11 +28,7 @@ module.exports = { included() { this._super.included.apply(this, arguments); - this.options['@embroider/macros'].setOwnConfig.config = findRoot( - this - ).project.config(process.env.EMBER_ENV); - - this.options['@embroider/macros'].setOwnConfig.testConfig = - findRoot(this).project.config('test'); + this.options['@embroider/macros'].setOwnConfig.modulePrefix = + findRoot(this).project.config().modulePrefix; }, };