emberjs / data

A lightweight reactive data library for web applications. Designed over composable primitives.
https://api.emberjs.com/ember-data/release
Other
3.03k stars 1.33k forks source link

Build fails on `4.12.0` if project folder name contains `ember-data-` #8606

Open dagroe opened 1 year ago

dagroe commented 1 year ago

Build fails on 4.12.0

Reproduction

I also tried to upgrade all dependencies to latest and pin them in my reproduction here: https://github.com/dagroe/ed-bug-reproduction

Description

I tried a bunch of different combinations, e.g. plain new ember install, upgrade all to latest, upgrade everything to latest but set ember-source: 4.12.0. Tried yarn and npm installs.

Everything works fine on 4.11.3 but fails with the error above on 4.12.0

Versions

└─ ember-data-bug@workspace:.
   └─ ember-source@npm:4.12.0 [a2ed2] (via npm:4.12.0 [a2ed2])
└─ ember-data-bug@workspace:.
   └─ ember-cli@npm:4.12.1 (via npm:4.12.1)
└─ ember-data-bug@workspace:.
   └─ ember-data@npm:4.12.0 [a2ed2] (via npm:4.12.0 [a2ed2])
runspired commented 1 year ago

As far as I can tell builds are working with 4.12

runspired commented 1 year ago

Closing because even the reproduction app works when I run yarn to install and ember build to build or ember serve to serve

dagroe commented 1 year ago

Very strange. Indeed, when I clone the repo it runs fine.

Drove me almost crazy, since the exact same project didn't run in my original folder where I created it. Finally I found that the error occurs when the project folder name includes the string ember-data. My original project was in folder ember-data-bug but I pushed it to github as ed-bug-reproduction. When I clone the ed-bug-reproduction repo into something like ember-data-test I get the error described above.

gilest commented 1 year ago

I have also (accidentally) encountered this in ember-data v5.

Cloning a app repository name containing ember-data

(This repo is an app generated by ember-cli v5)

git clone git@github.com:gilest/ember-data-dir-name.git
cd ember-data-dir-name && pnpm install && pnpm start

Output ❌

[NodeWrapper:0 /Users/Giles/code/repros/ember-data-dir-name/node_modules/.pnpm/registry.npmjs.org+@ember+optional-features@2.0.0/node_modules/@ember/optional-features] is not a SourceNode

Cloning same repo into a different-directory

git clone git@github.com:gilest/ember-data-dir-name.git different-directory
cd different-directory && pnpm install && pnpm start

Output ✅

Build successful (4928ms) – Serving on http://localhost:4200/
runspired commented 1 year ago

@gilest yeah its honestly one of the most curious bugs I've heard in a long time and ordinarily I'd jump at investigating but haven't had time. Would love a report/fix if you can dig around, its... WAT

gilest commented 1 year ago

Not sure I'll get all the way to a fix but it occurs...

NodeWrapper is something in Broccoli maybe?

Yes, error thrown from here.

🤷🏻 opened a Broccoli issue broccolijs/broccoli/issues/503

bertdeblock commented 1 year ago

Running into the same issue. My addon's name is @bagaaravel/ember-data-extensions. On my machine the folder name was ember-data-extensions. Renaming the folder "fixes" it.

runspired commented 1 year ago

@bertdeblock think you could dig into the broccoli side a bit?

runspired commented 1 year ago

The only EmberData code I could imagine might interplay to result in this has existed a long time. It's this check:

https://github.com/emberjs/data/blob/4251fd7105ea9a8eae17efb4e3bf8bb795b42ca4/packages/private-build-infra/src/addon-build-config-for-data-package.js#L118C5-L127C7

but reading that I don't see how it could affect.

bertdeblock commented 1 year ago

@runspired I've been looking into it a bit, but haven't found anything yet. Might continue looking at it today.