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

Error importing moment-timezone with ember-auto-import 2.6.2 #396

Open
dwickern opened this issue May 1, 2023 · 3 comments
Open

Error importing moment-timezone with ember-auto-import 2.6.2 #396

dwickern opened this issue May 1, 2023 · 3 comments

Comments

@dwickern
Copy link

dwickern commented May 1, 2023

After upgrading ember-auto-import from 2.6.1 to 2.6.2, the app has a runtime failure importing moment-timezone:

caught (in promise) Error: Could not find module `moment-timezone` imported from `ember-moment/services/moment.js`
    at missingModule (loader.js:247:1)
    at findModule (loader.js:258:1)
    at Module.findDeps (loader.js:168:1)
    at findModule (loader.js:262:1)
    at Module.findDeps (loader.js:168:1)
    at findModule (loader.js:262:1)
    at requireModule (loader.js:24:1)
    at ModuleRegistry.get (index.js:30:1)
    at Class._extractDefaultExport (index.js:464:1)
    at Class.resolveOther (index.js:126:1)

The app does not have a dependency on moment-timezone.

@NullVoxPopuli
Copy link
Collaborator

Are you using yarn or npm? Is it possible that the devDeps of ember-moment got installed, or some other dependency has brought in moment-timezone, and dependency hoisting my the package manager has caused an incorrect node_modules, making ember-moment think moment-timezone is there?

yarn why moment-timezone
npm ls moment-timezone 

Other than that, a reproduction repo would be most helpful

@mehran-naghizadeh
Copy link

mehran-naghizadeh commented May 22, 2023

I have the same issue. This is the error message I get in the browser console:

Uncaught Error: Could not find module moment-timezone imported from ember-moment/services/moment
at vendor-0d27e4b18fc275130628c0dc4d87016a.js:259:11
at c (vendor-0d27e4b18fc275130628c0dc4d87016a.js:270:7)
at a.findDeps (vendor-0d27e4b18fc275130628c0dc4d87016a.js:180:24)
at c (vendor-0d27e4b18fc275130628c0dc4d87016a.js:274:11)
at a.findDeps (vendor-0d27e4b18fc275130628c0dc4d87016a.js:180:24)
at c (vendor-0d27e4b18fc275130628c0dc4d87016a.js:274:11)
at requireModule (vendor-0d27e4b18fc275130628c0dc4d87016a.js:36:15)
at e.value (vendor-0d27e4b18fc275130628c0dc4d87016a.js:196071:24)
at r._extractDefaultExport (vendor-0d27e4b18fc275130628c0dc4d87016a.js:196427:41)
at r.resolveOther (vendor-0d27e4b18fc275130628c0dc4d87016a.js:196157:32)

In the package.json file, I have:

"ember-auto-import": "^2.6.0",
"ember-cli-moment-shim": "^3.8.0",
"ember-moment": "^9.0.1",
"moment-duration-format": "^2.3.2",

According to yarn:

Found "moment-timezone@0.5.43"
Reasons this module exists

  • "ember-cli-moment-shim" depends on it
  • Hoisted from "ember-cli-moment-shim#moment-timezone"
  • Hoisted from "ember-moment#moment-timezone"

@dwickern
Copy link
Author

@mehran-naghizadeh there's a workaround in embroider-build/ember-auto-import#578 (comment)

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

No branches or pull requests

3 participants