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

Could not find module ember-get-config imported from (require) #823

Closed
maxymczech opened this issue May 24, 2021 · 14 comments · Fixed by #1030
Closed

Could not find module ember-get-config imported from (require) #823

maxymczech opened this issue May 24, 2021 · 14 comments · Fixed by #1030

Comments

@maxymczech
Copy link

Hello. I am trying to migrate Ember app to Embroider and I am getting this error from several addon packages:

  • ember-cli-moment-shim
  • ember-drag-drop-polyfill

I am using Ember 3.26 and Embroider 0.41.0

@maxymczech
Copy link
Author

@alexlafroscia it seems this error might be caused by ember-get-config compat adapter that you wrote in #770. I have tried removing it from my node_modules/@embroider/compat/src/ember-get-config.* and now my application loads perfectly fine. What could be the reason for that? If you have time, can you please look into this?

@ef4
Copy link
Contributor

ef4 commented May 24, 2021 via email

@maxymczech
Copy link
Author

@ef4 Thank you very much, it works. The question however remains, why did the compat adapter cause problems in the first place.

@ef4
Copy link
Contributor

ef4 commented May 24, 2021

Agreed, that is just a workaround until we can sort it out. If it's not needed, great, we can delete it. The goal is to eventually delete all the compat adapters as addons become compatible enough without them.

@maxymczech
Copy link
Author

Thank you for clarification. In that case I am closing the issue.

@ef4
Copy link
Contributor

ef4 commented May 24, 2021

We can keep this open so we remember to either delete it or figure out which versions really need it.

@ef4 ef4 reopened this May 24, 2021
@alexlafroscia
Copy link
Contributor

alexlafroscia commented May 24, 2021

The compat adapter was created originally because ember-get-config generates (or did, at the time that I wrote it) a module that itself depends on your host app without actually listing it as a dependency. This kind of implicit dependency on a module -- especially when that module is the host app -- isn't valid.

When talking through that fact with @ef4, it was suggested that we use a compat adapter to generate a different implementation with the same outcome, that doesn't require the addon depending on the host app.

It's possible ember-get-config has updated to no longer do that, or do it in a safer way.

What kind of error did you see?

@maxymczech
Copy link
Author

maxymczech commented May 24, 2021

What kind of error did you see?

The one in issue title: Could not find module ember-get-config imported from (require)

@johanrd
Copy link
Contributor

johanrd commented Aug 17, 2021

I get the same error as @maxymczech above when running with v >= 0.41 (when e.g. ember-cli-notifications is installed). No errors when building with v0.40.

Adding compatAdapters: new Map([['ember-get-config', null]]) did not seem to help, so I'm stranded on v0.40 for now.

@maxymczech
Copy link
Author

@johanrd Our app is currently on version 0.43.0 of embroider. Here is the config that is currently working for me, maybe something from there will help:

  return require('@embroider/compat').compatBuild(app, Webpack, {
    compatAdapters: new Map([
      ['ember-get-config', null]
    ]),

    packagerOptions: {
      webpackConfig: {
        // Generate source maps
        devtool: (process.env.EMBER_ENV === 'production' ? 'cheap-source-map' : 'eval'),

        plugins: [
          new MomentLocalesPlugin({
            localesToKeep: ['cs']
          })
        ],

        module: {
          rules: [{
            test: /ember-concurrency/,
            loader: 'string-replace-loader',
            options: {
              multiple: [
                {
                  search: '\\[yieldableSymbol\\]',
                  flags: 'g',
                  replace: '["__ec_yieldable__"]'
                },
                {
                  search: '\\[cancelableSymbol\\]',
                  flags: 'g',
                  replace: '["__ec_cancel__"]'
                }
              ]
            }
          }]
        }
      }
    },
    splitAtRoutes: [/^((?!application).)*$/],
    staticAddonTestSupportTrees: true,
    staticAddonTrees: true,
    staticComponents: true,
    staticHelpers: true
  });

@johanrd
Copy link
Contributor

johanrd commented Aug 17, 2021

@maxymczech thanks, tried again now, and it worked! Not sure why it failed an hour ago, thanks for the message.

@johanrd
Copy link
Contributor

johanrd commented Aug 17, 2021

FYI: Tried to reproduce now, and the issue comes back if I regenerate the yarn.lock file from scratch. Thus, the fix seems a bit vulnerable. Not sure what pin change is causing it, though.

Turbo87 added a commit to Turbo87/crates.io that referenced this issue Oct 20, 2021
Turbo87 added a commit to Turbo87/crates.io that referenced this issue Oct 21, 2021
Turbo87 added a commit to Turbo87/crates.io that referenced this issue Oct 24, 2021
Turbo87 added a commit to Turbo87/crates.io that referenced this issue Oct 25, 2021
Turbo87 added a commit to Turbo87/crates.io that referenced this issue Oct 25, 2021
bors added a commit to rust-lang/crates.io that referenced this issue Oct 25, 2021
embroider: Disable `ember-get-config` compat adapter

see embroider-build/embroider#823
MrChocolatine added a commit to DazzlingFugu/ember-feature-controls that referenced this issue Nov 1, 2021
`ember-get-config`, latest version 0.5.0, doesn't support Embroider yet
as this PR has not been merged as the time of writing this commit:

mansona/ember-get-config#29

In parallel, Embroider tests scenarios fail on our side:

https://github.com/peopledoc/ember-feature-controls/actions/runs/1408588177
  |
  `--> Relates to this issue:
       embroider-build/embroider#823

This issue 823 recommends to use `require('@embroider/compat').compatBuild`
in order to disable Embroider's adapter `ember-get-config` (see also
https://github.com/embroider-build/embroider/tree/v0.47.1#options).

But it does not work: `app` is not accepted by `compatBuild()` because
it is an `EmberAddon`, not an `EmberApp`. Log from from the said error:

```
Argument of type 'EmberAddon' is not assignable to parameter of type 'EmberAppInstance'.
  Property 'testIndex' is missing in type 'EmberAddon' but required in type 'EmberAppInstance'.ts(2345)
```

However, the following document indicates we can pass these options to
`maybeEmbroider()` configure Embroider:

https://github.com/embroider-build/embroider/tree/v0.47.1/packages/test-setup#maybeembroiderapp-embroideroptions

References:
- Embroider's adapter for `ember-get-config`:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/compat-adapters/ember-get-config.ts

- Embroider compatibility options:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/options.ts#L46-L61

- Discussions on Discord where I first saw the same initial issue:
  - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233
  - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433
MrChocolatine added a commit to DazzlingFugu/ember-feature-controls that referenced this issue Nov 1, 2021
`ember-get-config`, latest version 0.5.0, doesn't support Embroider yet
as this PR has not been merged as the time of writing this commit:

mansona/ember-get-config#29

In parallel, Embroider tests scenarios fail on our side:

https://github.com/peopledoc/ember-feature-controls/actions/runs/1408588177
  |
  `--> Relates to this issue:
       embroider-build/embroider#823

This issue 823 recommends to use `require('@embroider/compat').compatBuild`
in order to disable Embroider's adapter `ember-get-config` (see also
https://github.com/embroider-build/embroider/tree/v0.47.1#options).

But it does not work: `app` is not accepted by `compatBuild()` because
it is an `EmberAddon`, not an `EmberApp`. Log from the error:

```
Argument of type 'EmberAddon' is not assignable to parameter of type 'EmberAppInstance'.
  Property 'testIndex' is missing in type 'EmberAddon' but required in type 'EmberAppInstance'.ts(2345)
```

However, the following document indicates we can pass these options to
`maybeEmbroider()` to configure Embroider:

https://github.com/embroider-build/embroider/tree/v0.47.1/packages/test-setup#maybeembroiderapp-embroideroptions

References:
- Embroider's adapter for `ember-get-config`:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/compat-adapters/ember-get-config.ts

- Embroider compatibility options:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/options.ts#L46-L61

- Discussions on Discord where I first saw the same initial issue:
  - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233
  - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433
MrChocolatine added a commit to DazzlingFugu/ember-feature-controls that referenced this issue Nov 2, 2021
`ember-get-config`, latest version 0.5.0, doesn't support Embroider yet
as this PR has not been merged as the time of writing this commit:

mansona/ember-get-config#29

In parallel, Embroider tests scenarios fail on our side:

https://github.com/peopledoc/ember-feature-controls/actions/runs/1408588177
  |
  `--> Relates to this issue:
       embroider-build/embroider#823

This issue 823 recommends to use `require('@embroider/compat').compatBuild`
in order to disable Embroider's adapter `ember-get-config` (see also
https://github.com/embroider-build/embroider/tree/v0.47.1#options).

But it does not work: `app` is not accepted by `compatBuild()` because
it is an `EmberAddon`, not an `EmberApp`. Log from the error:

```
Argument of type 'EmberAddon' is not assignable to parameter of type 'EmberAppInstance'.
  Property 'testIndex' is missing in type 'EmberAddon' but required in type 'EmberAppInstance'.ts(2345)
```

However, the following document indicates we can pass these options to
`maybeEmbroider()` to configure Embroider:

https://github.com/embroider-build/embroider/tree/v0.47.1/packages/test-setup#maybeembroiderapp-embroideroptions

References:
- Embroider's adapter for `ember-get-config`:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/compat-adapters/ember-get-config.ts

- Embroider compatibility options:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/options.ts#L46-L61

- Discussions on Discord where I first saw the same initial issue:
  - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233
  - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433
MrChocolatine added a commit to DazzlingFugu/ember-feature-controls that referenced this issue Nov 2, 2021
`ember-get-config`, latest version 0.5.0, doesn't support Embroider yet
as this PR has not been merged as the time of writing this commit:

mansona/ember-get-config#29

In parallel, Embroider tests scenarios fail on our side:

https://github.com/peopledoc/ember-feature-controls/actions/runs/1408588177
  |
  `--> Relates to this issue:
       embroider-build/embroider#823

This issue 823 recommends to use `require('@embroider/compat').compatBuild`
in order to disable Embroider's adapter `ember-get-config` (see also
https://github.com/embroider-build/embroider/tree/v0.47.1#options).

But it does not work: `app` is not accepted by `compatBuild()` because
it is an `EmberAddon`, not an `EmberApp`. Log from the error:

```
Argument of type 'EmberAddon' is not assignable to parameter of type 'EmberAppInstance'.
  Property 'testIndex' is missing in type 'EmberAddon' but required in type 'EmberAppInstance'.ts(2345)
```

However, the following document indicates we can pass these options to
`maybeEmbroider()` to configure Embroider:

https://github.com/embroider-build/embroider/tree/v0.47.1/packages/test-setup#maybeembroiderapp-embroideroptions

References:
- Embroider's adapter for `ember-get-config`:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/compat-adapters/ember-get-config.ts

- Embroider compatibility options:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/options.ts#L46-L61

- Discussions on Discord where I first saw the same initial issue:
  - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233
  - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433
MrChocolatine added a commit to DazzlingFugu/ember-feature-controls that referenced this issue Nov 2, 2021
`ember-get-config`, latest version 0.5.0, doesn't support Embroider yet
as this PR has not been merged as the time of writing this commit:

mansona/ember-get-config#29

In parallel, Embroider tests scenarios fail on our side:

https://github.com/peopledoc/ember-feature-controls/actions/runs/1408588177
  |
  `--> Relates to this issue:
       embroider-build/embroider#823

This issue 823 recommends to use `require('@embroider/compat').compatBuild`
in order to disable Embroider's adapter `ember-get-config` (see also
https://github.com/embroider-build/embroider/tree/v0.47.1#options).

But it does not work: `app` is not accepted by `compatBuild()` because
it is an `EmberAddon`, not an `EmberApp`. Log from the error:

```
Argument of type 'EmberAddon' is not assignable to parameter of type 'EmberAppInstance'.
  Property 'testIndex' is missing in type 'EmberAddon' but required in type 'EmberAppInstance'.ts(2345)
```

However, the following document indicates we can pass these options to
`maybeEmbroider()` to configure Embroider:

https://github.com/embroider-build/embroider/tree/v0.47.1/packages/test-setup#maybeembroiderapp-embroideroptions

References:
- Embroider's adapter for `ember-get-config`:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/compat-adapters/ember-get-config.ts

- Embroider compatibility options:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/options.ts#L46-L61

- Discussions on Discord where I first saw the same initial issue:
  - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233
  - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433
MrChocolatine added a commit to DazzlingFugu/ember-feature-controls that referenced this issue Nov 2, 2021
`ember-get-config`, latest version 0.5.0, doesn't support Embroider yet
as this PR has not been merged as the time of writing this commit:

mansona/ember-get-config#29

In parallel, Embroider tests scenarios fail on our side:

https://github.com/peopledoc/ember-feature-controls/actions/runs/1408588177
  |
  `--> Relates to this issue:
       embroider-build/embroider#823

This issue 823 recommends to use `require('@embroider/compat').compatBuild`
in order to disable Embroider's adapter `ember-get-config` (see also
https://github.com/embroider-build/embroider/tree/v0.47.1#options).

But it does not work: `app` is not accepted by `compatBuild()` because
it is an `EmberAddon`, not an `EmberApp`. Log from the error:

```
Argument of type 'EmberAddon' is not assignable to parameter of type 'EmberAppInstance'.
  Property 'testIndex' is missing in type 'EmberAddon' but required in type 'EmberAppInstance'.ts(2345)
```

However, the following document indicates we can pass these options to
`maybeEmbroider()` to configure Embroider:

https://github.com/embroider-build/embroider/tree/v0.47.1/packages/test-setup#maybeembroiderapp-embroideroptions

References:
- Embroider's adapter for `ember-get-config`:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/compat-adapters/ember-get-config.ts

- Embroider compatibility options:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/options.ts#L46-L61

- Discussions on Discord where I first saw the same initial issue:
  - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233
  - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433
@rahulk94
Copy link

rahulk94 commented Dec 3, 2021

FYI: Tried to reproduce now, and the issue comes back if I regenerate the yarn.lock file from scratch. Thus, the fix seems a bit vulnerable. Not sure what pin change is causing it, though.

I also had things working previously with the existing ember-get-config compat adapter but after rebasing my branch onto master and regenerating my lock file with changes for Embroider this issue has come back for me. Setting the compat adapter to null also doesn't help unfortunately.

@ef4
Copy link
Contributor

ef4 commented Dec 3, 2021

This issue is fixed in PR #1030, which isn't merged yet.

@ef4 ef4 closed this as completed in #1030 Dec 7, 2021
bors added a commit to rust-lang/crates.io that referenced this issue Jan 20, 2022
embroider: Remove obsolete `ember-get-config` workaround

embroider-build/embroider#823 has been resolved by now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants