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

Cannot import from @glimmer/tracking/primitives/cache #1020

Closed
NullVoxPopuli opened this issue Nov 14, 2021 · 9 comments
Closed

Cannot import from @glimmer/tracking/primitives/cache #1020

NullVoxPopuli opened this issue Nov 14, 2021 · 9 comments

Comments

@NullVoxPopuli
Copy link
Collaborator

Using
@embroider/test-setup 0.47.2
ember-source ~3.28.0
ember-cli-babel ^7.26.6

And this code:

import { getValue } from '@glimmer/tracking/primitives/cache';

I'm getting this error:

Module not found: Error: Can't resolve '@glimmer/tracking/primitives/cache' in '$TMPDIR/embroider/2340f5/node_modules/ember-resources/dist/index.js'
Did you mean 'cache.js'?
BREAKING CHANGE: The request '@glimmer/tracking/primitives/cache' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

build: https://github.com/NullVoxPopuli/ember-resources/runs/4205184397?check_suite_focus=true#step:5:145

@NullVoxPopuli
Copy link
Collaborator Author

NullVoxPopuli commented Nov 19, 2021

also occurs on ember-source ~4.0.0
and all versions of webpack 5, it seems

@simonihmig
Copy link
Collaborator

Worth noting that this (failing) import is in a v2 addon (ember-resources)! 👆

I guess this might be related to @glimmer/tracking being a "virtual package"?

I looked and debugged a bit into https://github.com/embroider-build/embroider/blob/master/packages/core/src/babel-plugin-adjust-imports.ts, especially this part. Don't know if that's relevant, unfortunately I was not able to draw any conclusions...

Note that there are even more errors for different packages (see linked CI run above):

Module not found: Error: Can't resolve '../../../../externals/@ember/application' in '$TMPDIR/embroider/2340f5/node_modules/ember-resources/dist'
Did you mean 'application.js'?

@NullVoxPopuli
Copy link
Collaborator Author

NullVoxPopuli commented Dec 21, 2021

@ef4 are the compat adapters used for v2 addons?
(Or, should they be?)

@ef4
Copy link
Contributor

ef4 commented Dec 22, 2021

No, v2 addons don't run through the compat adapters. They exist to help convert v1 to v2.

But if you're asking if a v2 addon that consumes a v1 addon will see the v1 addon after it has gone through a compat adapter, yes, it needs to work that way.

@nightire
Copy link

@NullVoxPopuli Can't wait to use ember-resources@4 any longer 😭

@NullVoxPopuli
Copy link
Collaborator Author

I think this is resolved?

@nightire you can use latest ember-resources with embroider now <3

@nightire
Copy link

I think this is resolved?

@nightire you can use latest ember-resources with embroider now <3

Yes, I can confirm it works now, congrats!

@angelayanpan
Copy link
Collaborator

what was the fix again? I'm seeing Can't resolve '@glimmer/tracking'

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

5 participants