Skip to content

Commit 0739cb8

Browse files
authored
Merge pull request #585 from iezer/isaac/module-unification
Support module unification app in `/src/main`
2 parents 4ce71a6 + 519809d commit 0739cb8

4 files changed

Lines changed: 10 additions & 8 deletions

File tree

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ module.exports = {
9292
}
9393

9494
if (type === 'app-boot') {
95-
return fastbootAppModule(config.modulePrefix, JSON.stringify(config.APP || {}));
95+
const isModuleUnification = (typeof this.project.isModuleUnification === 'function') && this.project.isModuleUnification();
96+
return fastbootAppModule(config.modulePrefix, JSON.stringify(config.APP || {}), isModuleUnification);
9697
}
9798

9899
// if the fastboot addon is installed, we overwrite the config-module so that the config can be read

lib/utilities/fastboot-app-module.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
// The module defined here is prefixed with a `~` to make it less
88
// likely to collide with user code, since it is not possible to
99
// define a module with a name like this in the file system.
10-
module.exports = function fastbootAppModule(prefix, configAppAsString) {
10+
module.exports = function fastbootAppModule(prefix, configAppAsString, isModuleUnification) {
11+
var appSuffix = isModuleUnification ? "src/main" : "app";
1112
return [
1213
"",
1314
"if (typeof FastBoot === 'undefined') {",
1415
" if (!runningTests) {",
15-
" require('{{MODULE_PREFIX}}/app')['default'].create({{CONFIG_APP}});",
16+
" require('{{MODULE_PREFIX}}/" + appSuffix + "')['default'].create({{CONFIG_APP}});",
1617
" }",
1718
"}",
1819
"",
19-
"define('~fastboot/app-factory', ['{{MODULE_PREFIX}}/app', '{{MODULE_PREFIX}}/config/environment'], function(App, config) {",
20+
"define('~fastboot/app-factory', ['{{MODULE_PREFIX}}/" + appSuffix + "', '{{MODULE_PREFIX}}/config/environment'], function(App, config) {",
2021
" App = App['default'];",
2122
" config = config['default'];",
2223
"",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"ember-export-application-global": "^2.0.0",
6161
"ember-load-initializers": "^1.0.0",
6262
"ember-maybe-import-regenerator-for-testing": "^1.0.0",
63-
"ember-resolver": "^4.3.0",
63+
"ember-resolver": "^4.5.4",
6464
"ember-sinon": "^1.0.0",
6565
"ember-source": "~3.0.0",
6666
"eslint-plugin-ember": "^5.0.0",

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,9 +2355,9 @@ ember-qunit@^3.3.0:
23552355
ember-cli-test-loader "^2.2.0"
23562356
qunit "^2.5.0"
23572357

2358-
ember-resolver@^4.3.0:
2359-
version "4.5.0"
2360-
resolved "https://registry.yarnpkg.com/ember-resolver/-/ember-resolver-4.5.0.tgz#9248bf534dfc197fafe3118fff538d436078bf99"
2358+
ember-resolver@^4.5.4:
2359+
version "4.5.4"
2360+
resolved "https://registry.yarnpkg.com/ember-resolver/-/ember-resolver-4.5.4.tgz#39c06599b6859d6b476fb24ab31d850f2d1a74af"
23612361
dependencies:
23622362
"@glimmer/resolver" "^0.4.1"
23632363
babel-plugin-debug-macros "^0.1.10"

0 commit comments

Comments
 (0)