From 5493d11ae92fff96f296697169a61fed412490c5 Mon Sep 17 00:00:00 2001 From: Sam Van Campenhout Date: Thu, 16 Jun 2022 19:14:47 +0200 Subject: [PATCH] Use `require` to retrieve the app's config This uses loader.js's `require` function to retrieve the app's environment config. This bypasses the `importSync` dependency checking that happens in Embroider builds which causes the build to fail since the dependency doesn't exist in the addon. --- addon/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/addon/index.js b/addon/index.js index 4310895..f9c78ee 100644 --- a/addon/index.js +++ b/addon/index.js @@ -1,8 +1,6 @@ -import { getOwnConfig, importSync } from '@embroider/macros'; +/* global require */ +import { getOwnConfig } from '@embroider/macros'; let configModulePath = `${getOwnConfig().modulePrefix}/config/environment`; -let config = importSync(configModulePath); - -// fix problem with fastboot config being wrapped in a second "default" object -export default config.default?.default ?? config.default; +export default require(configModulePath).default;