Skip to content

Commit

Permalink
Use require to retrieve the app's config
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Windvis authored and mansona committed Jun 28, 2022
1 parent f70c39d commit 5493d11
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions addon/index.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 5493d11

Please sign in to comment.