Skip to content

Commit 7817b46

Browse files
committed
Support module unification app in /src/main
1 parent 4ce71a6 commit 7817b46

2 files changed

Lines changed: 6 additions & 4 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
"",

0 commit comments

Comments
 (0)