emberjs / ember-inflector

ember-inflector goal is to be rails compatible.
MIT License
106 stars 81 forks source link

@ember/string is not a dependency #347

Open timiyay opened 3 years ago

timiyay commented 3 years ago

This package imports @ember/string, but doesn't list it in its package.json: https://github.com/emberjs/ember-inflector/blob/06d0d8b038878060ed1139afade8b0418366917f/addon/lib/system/inflector.js#L1

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:

timiyay commented 3 years ago

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 commented 1 year ago

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

timiyay commented 1 year ago

@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 commented 5 months ago

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.