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

@ember/string is not a dependency #347

Open
timiyay opened this issue Apr 21, 2021 · 4 comments
Open

@ember/string is not a dependency #347

timiyay opened this issue Apr 21, 2021 · 4 comments

Comments

@timiyay
Copy link

timiyay commented Apr 21, 2021

This package imports @ember/string, but doesn't list it in its package.json:

import { capitalize } from '@ember/string';

I'm investigating an issue with a Yarn workspaces monorepo we have for our Ember addons, and opened this issue to try and clarify whether @ember/string is expected to be available some other way, such as via ember-source.

Our use case is:

  • we're incrementally upgrading our addons from Ember 3.20 to Ember 3.24
  • some addons have a dev dependency on ember-data
  • when ember-data is upgraded to ~3.24 for one addon, other addons that are still on ember-data@3.20 start failing CI with an error Uncaught Error: Could not find module @ember/string imported from 'ember-inflector/lib/system/inflector'
@timiyay
Copy link
Author

timiyay commented Apr 21, 2021

I'm still investigating exactly what's causing our issues, it may be a combination of issues related to Yarn workspaces hoisting, and the fact that ember-data@3.24 adds @ember/string as a dependency.

At present, everything seems in order though, both packages are installed in the top-level node_modules directory:

node_modules/@ember/string
node_modules/ember-inflector

@EWhite613
Copy link

@timiyay did you ever figure this out? I have a similar issue with my Yarn workspace

@timiyay
Copy link
Author

timiyay commented Aug 24, 2022

@EWhite613 we did, though I'm struggling to find the history of how we did it. We have some notes, but I'm not sure they were the final fix. I'll add them here anyway, in case it helps.

The trigger for our problems was upgrading ember-data from 3.20 to 3.24 in our Ember addons. This seemed to be enough to cause builds to fail with Uncaught Error: Could not find module @ember/string imported from ember-inflector/lib/system/inflector.

This error would show up in the apps that consume these addons, when trying to build.

Our fix was to upgrade ember-data all in one push for all addons, which was easy enough since they were in 1 monorepo.

After that, we'd have to bump these addons and ember-data in our apps at the same time.

That's the best I can recall of our story 😅

@elfin-sbreuers
Copy link

Ember 5 removed automatic import of @ember/string. Wouldn't it be necessary to add @ember/string now to the dev-dependencies of this project, since it is using features of this module? That would allow to use it in Ember 5 projects without needing to list @ember/string as dependency though it is not really used in the project itself.

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