Skip to content

Commit

Permalink
feat (new app-boot): the entry point exports the amdModules, which ar…
Browse files Browse the repository at this point in the history
…e then define in app.js
  • Loading branch information
BlueCutOfficial committed Jun 25, 2024
1 parent 9993260 commit a49d44c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
7 changes: 6 additions & 1 deletion packages/core/src/virtual-entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ import environment from './config/environment';
{{#each amdModules as |amdModule index| ~}}
import * as amdModule{{index}} from "{{js-string-escape amdModule.buildtime}}"
d("{{js-string-escape amdModule.runtime}}", function(){ return amdModule{{index}}; });
{{/each}}
{{#if fastbootOnlyAmdModules}}
Expand Down Expand Up @@ -226,6 +225,12 @@ w._embroiderEngineBundles_ = [
{{/each}}
]
{{/if}}
export default {
{{#each amdModules as |amdModule index| ~}}
"{{js-string-escape amdModule.runtime}}": amdModule{{index}},
{{/each}}
};
`) as (params: {
amdModules: { runtime: string; buildtime: string }[];
fastbootOnlyAmdModules?: { runtime: string; buildtime: string }[];
Expand Down
10 changes: 9 additions & 1 deletion tests/addon-template/tests/dummy/app/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import Application from '@ember/application';
import '@embroider/core/entrypoint';
import coreModules from '@embroider/core/entrypoint';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'dummy/config/environment';

import '@embroider/core/entrypoint';
let d = window.define;

for (const [name, module] of Object.entries(coreModules)) {
d(name, function () {
return module;
});
}

export default class App extends Application {
modulePrefix = config.modulePrefix;
Expand Down
10 changes: 9 additions & 1 deletion tests/app-template/app/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import Application from '@ember/application';
import '@embroider/core/entrypoint';
import coreModules from '@embroider/core/entrypoint';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

import '@embroider/core/entrypoint';
let d = window.define;

for (const [name, module] of Object.entries(coreModules)) {
d(name, function () {
return module;
});
}

export default class App extends Application {
modulePrefix = config.modulePrefix;
Expand Down
12 changes: 11 additions & 1 deletion tests/ts-app-template/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import Application from '@ember/application';
import '@embroider/core/entrypoint';
// @ts-ignore
import coreModules from '@embroider/core/entrypoint';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'ts-app-template/config/environment';

import '@embroider/core/entrypoint';
// @ts-ignore
let d = window.define;

for (const [name, module] of Object.entries(coreModules)) {
d(name, function () {
return module;
});
}

export default class App extends Application {
modulePrefix = config.modulePrefix;
Expand Down

0 comments on commit a49d44c

Please sign in to comment.