@@ -23,7 +23,36 @@ export default {
23
23
// These are the modules that should get reexported into the traditional
24
24
// "app" tree. Things in here should also be in publicEntrypoints above, but
25
25
// not everything in publicEntrypoints necessarily needs to go here.
26
- addon . appReexports ( [ 'initializers/**/*.js' , 'services/**/*.js' ] ) ,
26
+ // addon.appReexports(['initializers/**/*.js', 'services/**/*.js']),
27
+
28
+ // For some reason, if v2 addon is dependency of an engine,
29
+ // it does not get bundled when host app is built.
30
+ //
31
+ // A small change to format of re-export file makes it work,
32
+ // however not clear exactly what is the root cause of such behavior, see
33
+ // https://github.com/villander/ember-engines-router-service/issues/67#issuecomment-1253285115
34
+ //
35
+ // Below snippet extracted from
36
+ // https://github.com/embroider-build/embroider/blob/main/packages/addon-dev/src/rollup-app-reexports.ts
37
+ {
38
+ name : 'custom-app-reexport' ,
39
+ async generateBundle ( ) {
40
+ this . emitFile ( {
41
+ type : 'asset' ,
42
+ fileName : '_app_/initializers/ember-engines-router-service.js' ,
43
+ source :
44
+ 'import initializer from "ember-engines-router-service/initializers/ember-engines-router-service";\n' +
45
+ 'export { initializer as default, initializer };\n' ,
46
+ } ) ;
47
+ this . emitFile ( {
48
+ type : 'asset' ,
49
+ fileName : '_app_/services/engine-router-service.js' ,
50
+ source :
51
+ 'import service from "ember-engines-router-service/services/engine-router-service";\n' +
52
+ 'export default service;\n' ,
53
+ } ) ;
54
+ } ,
55
+ } ,
27
56
28
57
// This babel config should *not* apply presets or compile away ES modules.
29
58
// It exists only to provide development niceties for you, like automatic
0 commit comments