Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embroider optimized fails with Ember Data 4.12.x #1506

Closed
jrjohnson opened this issue Jul 1, 2023 · 4 comments · Fixed by #1563
Closed

Embroider optimized fails with Ember Data 4.12.x #1506

jrjohnson opened this issue Jul 1, 2023 · 4 comments · Fixed by #1563
Labels
bug Something isn't working has reproduction

Comments

@jrjohnson
Copy link
Contributor

jrjohnson commented Jul 1, 2023

In an addon with ember-data installed the embroider optimized scenario fails with:

Uncaught Error: Could not find module `@ember-data/store` imported from `(require)

Steps to reproduce

  1. $ ember addon emberFiveDataFourEmbroider
  2. $ ember install ember-data@4.12.3
  3. $ ember try:one embroider-optimized

Just in case I tried it after the release of v3.1.4 and it still fails. It passes with ember-data v5.x (or least doesn't fail in this obvious way).

@Windvis
Copy link
Collaborator

Windvis commented Jul 12, 2023

It seems the compat adapters are disabled on ember-data 4.11.1+. It looks like v4.* isn't Embroider compatible and the adapters only hid the underlying issue?

@ember-data/debug is still importing from @ember-data/store without listing it as a dependency: https://github.com/emberjs/data/blob/00e572aa2d4315fda5aeba03540e9d81be6297bb/packages/debug/addon/setup.js#L3

In v5 that file is removed so that could explain why it works there.

So I think enabling (some of) the compat adapters might be a workaround if this can't be easily fixed on the Ember Data side.

Edit: I was able to get it working again by enabling the @ember-data/debug and @ember-data/store compat adapters.

Windvis added a commit to lblod/frontend-burgernabije-besluitendatabank that referenced this issue Jul 12, 2023
Adding the compatAdapters is a temporary workaround until the issue is resolved upstream somehow.

More information: embroider-build/embroider#1506
Windvis added a commit to lblod/frontend-burgernabije-besluitendatabank that referenced this issue Jul 12, 2023
Adding the compatAdapters is a temporary workaround until the issue is resolved upstream somehow.

More information: embroider-build/embroider#1506
@Windvis
Copy link
Collaborator

Windvis commented Jul 13, 2023

Small update: @ember-data/debug 4.12.3 now lists @ember-data/store as a peerDependency, but I still see the same runtime error after updating. So something else might still be going on. (I deleted the node_modules/.embroider folder to be sure).

@jrjohnson jrjohnson changed the title Embroider optimized fails with Ember Data 4.12.1 Embroider optimized fails with Ember Data 4.12.x Jul 26, 2023
@jrjohnson
Copy link
Contributor Author

Confirmed as still failing with ember-data v4.12.3 as well as v3.2.0 of embroider libs with the same error message:
not ok 1 Chrome 114.0 - [undefined ms] - Global error: Uncaught Error: Could not find module @ember-data/storeimported from(require) at http://localhost:7357/assets/vendor.js, line 254

I also touched up the issue name and the reproduction steps.

@mkszepp
Copy link
Contributor

mkszepp commented Jul 28, 2023

There were added some new compactAdapters for EmberData in #1435. One of this is causing problem with ember-data v4.12.x

Workaround is to disable the compactAdapter in app:

return require('@embroider/compat').compatBuild(app, Webpack, {
    skipBabel: [
      {
        package: 'qunit',
      },
    ],
    staticAddonTestSupportTrees: true,
    staticAddonTrees: true,
    staticHelpers: true,
    staticComponents: true,
    compatAdapters: new Map([
      ['@ember-data/debug', null],
    ]),
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has reproduction
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants