When I update my ember-data to 3.16.0 and deploy to a production env the error Could not find module @ember-data/debug imported from ember-data/index happen once I try to access the page through a browser.
Maybe it is a compatibility issue with fastboot since the error is being trowed by node and not by the browser.
When I rollback to 3.15.0 it works as expected.
鈹溾攢 @ember-data/[email protected]
鈹溾攢 @ember-data/[email protected]
鈹溾攢 @ember-data/[email protected]
鈹溾攢 @ember-data/[email protected]
鈹溾攢 @ember-data/[email protected]
鈹溾攢 @ember-data/[email protected]
鈹溾攢 @ember-data/[email protected]
鈹溾攢 @ember-data/[email protected]
鈹溾攢 @ember-data/[email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹斺攢 [email protected]
I've tried to do a reproduction repository, but the error happens only on production env with a node app serving the app with fastboot.
How are you serving it up for fastboot? Debug can be excluded from production builds in some cases, though by default it ships if the parent addon is ember-data
I'm using fastboot-app-server with express js. It's probably being excluded, but if it is optional, why is ember data trying to import it?
if it is optional, why is ember data trying to import it?
If your app uses the ember-data package (as nearly all users currently do) it will try to import it. It is only excluded by default when
1) you are in a production build AND
2) you are not using the ember-data package
It is possible there is a broken check but given the lack of reports outside of this one I currently suspect there is either (1) something weird about the build-env for fastboot-app-server or (2) something weird in how your app specifies the dependency or (3) something bad being done by the app/an add-on. FactoryGuy is a common culprit for such things.
I'm seeing precisely the same problem on two different apps after upgrading. One uses Fastboot and the other doesn't.
In both cases, the development build has no issues. Also, in both cases, reverting to 3.15.1 resolves the problem.
I know this description probably doesn't help, so I'll try to find the time to get a bare-bones repro and post it here when I have it.
We are having same issue after update to 3.16. To workaround the issue if you are using Ember-Data in your app in ~/your_app/ember-cli-build.js do this:
const EmberApp = require("ember-cli/lib/broccoli/ember-app");
module.exports = function (defaults) {
const app = new EmberApp(defaults, {
// Delete or comment out below code
//emberData: {
// includeDataAdapterInProduction: false
//},
storeConfigInMeta: false
});
return app.toTree();
};
@enterpub are you saying your app has that config or has commented out that config?
@runspired , sorry for misunderstanding. I meant first my app had includeDataAdapterInProduction: false included in ~/your_app/ember-cli-build.js, which lead to en error Could not find module @ember-data/debug imported from ember-data/index .But later I commented out the code as shown above and app started working in "prod" environment as expected.
@enterpub thanks! that likely tells me the issue is that the above flag doesn't work properly when the ember-data package is present since the import is still used. Which is something I can fix :)
Likely all that needs to be changed is for this line: https://github.com/emberjs/data/blob/1f80a437e0a58c65ab5d2f56dbe3595c6c863a94/packages/-ember-data/addon/index.js#L21
And this line: https://github.com/emberjs/data/blob/1f80a437e0a58c65ab5d2f56dbe3595c6c863a94/packages/-ember-data/addon/index.js#L88
To be lazily computed and wrapped in a package check.
e.g.
if (HAS_DEBUG_PACKAGE) {
DS.DebugAdapter = require('@ember/debug').default;
}
Most helpful comment
@enterpub thanks! that likely tells me the issue is that the above flag doesn't work properly when the
ember-datapackage is present since the import is still used. Which is something I can fix :)