[Bug] Preview types PR causes ember-auto-import CI to fail
See original GitHub issue🐞 Describe the Bug
I’m deep on a rabbit hole to fix something in ember-auto-import and I’ve hit another unrelated CI breakage 😞 Essentially some of ember-auto-import’s (large) CI matrix is broken and I’ve tracked it down to the first commit in this PR: https://github.com/emberjs/ember.js/pull/20180 using git bisect:
➜ ember.js git:(6278a8b7c) git bisect bad
6278a8b7cfe55ef2b138ec7d1324bc5cc79544c3 is the first bad commit
commit 6278a8b7cfe55ef2b138ec7d1324bc5cc79544c3
Author: Chris Krycho <redacted@redacted.redacted>
Date: Mon Aug 22 21:32:04 2022 -0600
I don’t understand the error or why adding types might cause this particular problem in this particular test but this is what it is complaining about:
message: |
Build Error (broccoli-persistent-filter:Babel > [Babel: ember-source]) in @ember/-internals/bootstrap/index.js
[BABEL]: Cannot find module '@babel/core'
Require stack:
- /tmp/tmp-[18](https://github.com/ef4/ember-auto-import/runs/8259214273?check_suite_focus=true#step:6:19)35QNd8rBD1GlmJ/node_modules/ember-source/node_modules/@babel/plugin-transform-block-scoping/lib/tdz.js
- /tmp/tmp-1835QNd8rBD1GlmJ/node_modules/ember-source/node_modules/@babel/plugin-transform-block-scoping/lib/index.js
- /home/runner/work/ember-auto-import/ember-auto-import/node_modules/@babel/core/lib/config/files/module-types.js
- /home/runner/work/ember-auto-import/ember-auto-import/node_modules/@babel/core/lib/config/files/configuration.js
You can see the full CI error here
🔬 Minimal Reproduction
You can use the ember-auto-import CI suite to test this.
- clone https://github.com/ef4/ember-auto-import
- run
npm i
in the root folder - (maybe you need to run
npm update ember-source-canary
in the root folder, I’m not sure) - cd test-scenarios
- run
npm run test -- --filter canary-addon-dev-dep:
- 💥 it breaks
I was able to run git bisect on ember.js for this by replacing the dependency line for ember-source-canary
in test-scenarios/package.json
for "ember-source-canary": "file:/Users/mansona/git/opensource/ember/ember.js",
(i.e. my local check of ember.js). For some reason you still need to run npm i
in the root folder of ember-auto-import
if you’re going to do this
😕 Actual Behavior
I think it’s a runtime error since it’s being reported as a qunit error 🤔 which leads me to believe that something that should be transpiled isn’t getting transpiled
🤔 Expected Behavior
No errors, build or runtime 🤷
🌍 Environment
- Ember: Canary (at time of writing)
- Node.js/npm: Node: v14.16.0 npm: 8.3.0
- OS: macOS and ubuntu (on CI)
- Browser: N/A (just running ember test on command line)
➕ Additional Context
Issue Analytics
- State:
- Created a year ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
Yes, we can close this issue.
The bug is probably in https://github.com/stefanpenner/node-fixturify-project, specifically in the package linking code that I added there.
Incidentally, I see that ember-source depends on
@babel/plugin-transform-block-scoping
but fails to satisfy that package’s peerDep on@babel/core
.Most of the time that works by accident, because another package (ember-cli-babel) has its own dependency on
@babel/core
and npm decides to hoist@babel/core
into a place where@babel/plugin-transform-block-scoping
happens to be able to see it. But it’s pretty fragile! There is no path of declared dependencies that actually communicates to users or the package manager that to use ember-source you must have@babel/core
.(I don’t actually think somebody should rush into fixing that. Because I think ember-source should instead drop the
@babel/plugin-transform-block-scoping
dependency entirely. Because it shouldn’t be providing ES modules via treeForVendor where such manual shenanigans are required. Modules in treeForAddon would get that plugin automatically.)