Skip to content

Commit

Permalink
Merge pull request #37 from embroider-build/new-index
Browse files Browse the repository at this point in the history
add new app.js structure
  • Loading branch information
mansona authored Jun 27, 2024
2 parents 348b946 + bf2c5fe commit 3472bf7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
9 changes: 7 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ export default [
languageOptions: { sourceType: 'commonjs' },
},
{
files: ['files/app/**/*.js'],
languageOptions: { sourceType: 'module' },
files: ['files/app/**/*.js', 'files-override/app/**/*.js'],
languageOptions: {
sourceType: 'module',
globals: {
...globals.browser,
},
},
},
{ languageOptions: { globals: globals.node } },
pluginJs.configs.recommended,
Expand Down
21 changes: 21 additions & 0 deletions files-override/app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Application from '@ember/application';
import compatModules from '@embroider/core/entrypoint';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

let d = window.define;

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

export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;
Resolver = Resolver;
}

loadInitializers(App, config.modulePrefix);
7 changes: 6 additions & 1 deletion files-override/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
{{content-for "body"}}

<script src="/@embroider/core/vendor.js"></script>
<script src="/@embroider/core/entrypoint" type="module"></script>
<script type="module">
import Application from './app';
import environment from './config/environment';

Application.create(environment.APP);
</script>

{{content-for "body-footer"}}
</body>
Expand Down

0 comments on commit 3472bf7

Please sign in to comment.