Skip to content

Commit

Permalink
Merge pull request #2245 from embroider-build/deprecate-static-ember
Browse files Browse the repository at this point in the history
add a simple deprecation for staticEmberSource: false
  • Loading branch information
ef4 authored Feb 4, 2025
2 parents 7cb8139 + 31a3573 commit a0967f7
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions packages/compat/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,19 @@ export default interface Options extends CoreOptions {
// apply.
staticAddonTestSupportTrees?: boolean;

// when true, we will load ember-source as ES modules. This means unused parts
// of ember-source won't be included. But it also means that addons using old
// APIs to try to `require()` things from Ember -- particularly from within
// vendor.js -- cannot do that anymore.
//
// When false (the default) we load ember-source the traditional way, which is
// that a big ol' script gets smooshed into vendor.js, and none of ember's
// public module API actually exists as modules at build time.
/**
* When true, we will load ember-source as ES modules. This means unused parts
* of ember-source won't be included. But it also means that addons using old
* APIs to try to `require()` things from Ember -- particularly from within
* vendor.js -- cannot do that anymore.
*
* When false (the default) we load ember-source the traditional way, which is
* that a big ol' script gets smooshed into vendor.js, and none of ember's
* public module API actually exists as modules at build time.
*
* Note: This setting will be removed in the next version of Embroider and
* will effectively default to true
*/
staticEmberSource?: boolean;

// Allows you to override how specific addons will build. Like:
Expand Down Expand Up @@ -114,6 +119,11 @@ export type CompatOptionsType = Required<
Pick<Options, 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'staticInvokables'>;

export function optionsWithDefaults(options?: Options): CompatOptionsType {
if (!options?.staticEmberSource) {
console.log(
`The setting 'staticEmberSource' will default to true in the next version of Embroider and can't be turned off. To prepare for this you should set 'staticEmberSource: true' in your Embroider config.`
);
}
return Object.assign({}, defaults, options);
}

Expand Down

0 comments on commit a0967f7

Please sign in to comment.