-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Container is falsy
after upgrading to latest
#112
Comments
@tzellman thank you for reporting! Is there any way that you could help me identify what usage inside the file is causing the issue? Either by sharing the rest of the file contents (here or privately), or slowly deleting contents until it builds properly. Basically, some usage pattern that I haven’t properly accounted for is trigger this and I need to figure out what that is so we can fix it. |
Sure thing! I honestly wasn't sure if this was the right place to report this (I was considering posting on Discord, but decided to keep the audience more targeted). I apologize for not giving much context or repro'ing outside of a private repo, but I can get you that shortly! |
Awesome, thank you! I don't fully grok what triggers this 🤔 |
For context, the error that is being thrown is from: Which is when we are calling babel-plugin-ember-modules-api-polyfill/src/index.js Lines 178 to 182 in 3215df3
|
Ok, here are some more details I should have provided up front, and may have helped isolate the issue:
'use strict';
module.exports = {
useBabelInstrumenter: true
};
I will share a repo shortly. |
Hmm, interesting. I wonder if this is an interop issue between |
I don't think that flag does anything anymore: |
Thanks for the info! I pushed a repo that demonstrates the error: https://github.com/tzellman/repro-112 There are some unnecessary deps, and I likely could reproduce in a simpler fashion, but hopefully this helps to see the main Ember-related dependencies. Let me know if there is something I should try to help out here. 👍 |
We are seeing this issue too, on a dependabot PR upgrading ember-cli-babel from 7.20.0 to 7.20.4 (so babel-plugin-ember-modules-api-polyfill from 2.13.0 to 2.13.3). Indeed, turning off code coverage fixed the issue, and the model in question uses |
For anyone else who comes here looking for a workaround, I was able to get it working using yarn resolutions, since my project didn't directly depend on this package, and only included it as the dependency of a dependency
{
"name": "blah",
"private": true
"dependencies": {
// etc
},
"resolutions": {
"babel-plugin-ember-modules-api-polyfill": "2.13.0"
}
} |
In my case, I'm have ember-cli-code-coverage in ➜ dash git:(master) ✗ yarn run test:cov --server
yarn run v1.22.4
$ LINTER=false COVERAGE=true ember test --server
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade` Then after the command when I try to run the tests: - broccoliBuilderErrorStack: ReferenceError: /builds/trustvox/dash.js/dash/services/filters.js: Container is falsy
at NodePath._replaceWith (/builds/trustvox/dash.js/node_modules/@babel/traverse/lib/path/replacement.js:166:11)
at NodePath.replaceWith (/builds/trustvox/dash.js/node_modules/@babel/traverse/lib/path/replacement.js:156:8)
at /builds/trustvox/dash.js/node_modules/babel-plugin-ember-modules-api-polyfill/src/index.js:173:33
at Array.forEach (<anonymous>)
at /builds/trustvox/dash.js/node_modules/babel-plugin-ember-modules-api-polyfill/src/index.js:171:38
at Array.forEach (<anonymous>)
at PluginPass.ImportDeclaration (/builds/trustvox/dash.js/node_modules/babel-plugin-ember-modules-api-polyfill/src/index.js:106:22)
at newFn (/builds/trustvox/dash.js/node_modules/@babel/traverse/lib/visitors.js:179:21)
at NodePath._call (/builds/trustvox/dash.js/node_modules/@babel/traverse/lib/path/context.js:55:20)
at NodePath.call (/builds/trustvox/dash.js/node_modules/@babel/traverse/lib/path/context.js:42:17)
- code: [undefined]
- codeFrame: /builds/trustvox/dash.js/dash/services/filters.js: Container is falsy
- errorMessage: dash/services/filters.js: /builds/trustvox/dash.js/dash/services/filters.js: Container is falsy
in /tmp/broccoli-79liy212tJVnKl/out-462-analyzer_ember_auto_import_analyzer
at broccoli-persistent-filter:Babel > [Babel: dash] (Babel: dash)
- errorType: Build Error
- location:
- column: [undefined]
- file: dash/services/filters.js
- line: [undefined]
- treeDir: /tmp/broccoli-79liy212tJVnKl/out-462-analyzer_ember_auto_import_analyzer
- message: dash/services/filters.js: /builds/trustvox/dash.js/dash/services/filters.js: Container is falsy
in /tmp/broccoli-79liy212tJVnKl/out-462-analyzer_ember_auto_import_analyzer
at broccoli-persistent-filter:Babel > [Babel: dash] (Babel: dash)
- name: Error
- nodeAnnotation: Babel: dash
- nodeName: broccoli-persistent-filter:Babel > [Babel: dash]
- originalErrorMessage: /builds/trustvox/dash.js/dash/services/filters.js: Container is falsy
- stack: ReferenceError: /builds/trustvox/dash.js/dash/services/filters.js: Container is falsy
at NodePath._replaceWith (/builds/trustvox/dash.js/node_modules/@babel/traverse/lib/path/replacement.js:166:11)
at NodePath.replaceWith (/builds/trustvox/dash.js/node_modules/@babel/traverse/lib/path/replacement.js:156:8)
at /builds/trustvox/dash.js/node_modules/babel-plugin-ember-modules-api-polyfill/src/index.js:173:33
at Array.forEach (<anonymous>)
at /builds/trustvox/dash.js/node_modules/babel-plugin-ember-modules-api-polyfill/src/index.js:171:38
at Array.forEach (<anonymous>)
at PluginPass.ImportDeclaration (/builds/trustvox/dash.js/node_modules/babel-plugin-ember-modules-api-polyfill/src/index.js:106:22)
at newFn (/builds/trustvox/dash.js/node_modules/@babel/traverse/lib/visitors.js:179:21)
at NodePath._call (/builds/trustvox/dash.js/node_modules/@babel/traverse/lib/path/context.js:55:20)
at NodePath.call (/builds/trustvox/dash.js/node_modules/@babel/traverse/lib/path/context.js:42:17)
================================================================================= My import Service from '@ember/service';
import Evented from '@ember/object/evented';
import { A } from '@ember/array';
import { tracked } from '@glimmer/tracking';
import { computed } from '@ember/object';
export default class FiltersService extends Service.extend(Evented) {
...
} After trying to remove some parts of the file (including the whole class body) without success, I've removed the import of Hope it helps ;) |
I ran into this issue today after regenerating package-lock.json, and sub dependencies reached for It happens only when I run coverage generation via ember-cli-code-coverage. I could reproduce with both My stack traces look like everyone else's, but we are still on Ember 3.4 using the old class syntax, so the file in question contains this line: const PipelineLoaderArray = EmberObject.extend(EmberArray, { Wanted to share because I'm using a different Mixin ( When I remove the Mixin, coverage runs as expected. (But changes app behavior.) const PipelineLoaderArray = EmberObject.extend({ We aren't using yarn, so as a workaround I pinned this package to |
@apellerano-pw I'm having the same issue and your solution isn't working for me 😢. I'm using Ember v3.7.3. |
@Gorzas try
|
So the only thing that would work for me is to turn off code coverage tool |
Having the same error here! 😩 Any progress on solving this issue? Hitting it both on 3.20 and 3.16. |
Can confirm that this aslo affects extending from RSVP import classic from "ember-classic-decorator";
import EmberObject from "@ember/object";
import RSVP from "rsvp";
@classic
export default class Rsvp extends EmberObject.extend(RSVP) {} |
If i use yarn resolutions for
|
Just wondering if there's any resolution on this. We do not use |
For a temporary workaround, I forked chrisvdp/ember-cli-babel@dc8a5bd Then reference my fork in my package.json
|
Any updates here? The package.json resolution fix isn't applicable for us due to other packages requiring later versions than 2.13.0 (ember-cli-babel 7.21+ requirement). Is there anything with the reproduce project in here that people should try that might produce more information to fix this bug? |
I still think the thing I mentioned above is what is going on: there is a conflict between our modules import rewriting and babel-plugin-istanbul that causes the istanbul plugin from running on an object that no longer has a container (in the AST heirarchy), but I haven't had much time to dig in here. 😩 |
@rwjblue Any tips to help a person who might not know where to look to try to help? |
Another temporary workaround for those who cannot afford to change the package versions, try excluding the lines/files that cause the issue from istanbul coverage. /* istanbul ignore next */
const PipelineLoaderArray = EmberObject.extend(EmberArray, { /* istanbul ignore next */
export default class FiltersService extends Service.extend(Evented) { It worked for my case, without any other changes or packages. Ref: https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md |
I think a good next step is a failing test PR here, we have a few examples of "works with xyz plugin" in the test suite already so this should basically match those but use the Istanbul plugin. |
Fixed by @mdeanjones over in #156 (thank you!!!!!!). |
Hello! After a proposed
renovatebot
bump toember-cli-babel
7.20.3
(and thus2.13.3
ofbabel-plugin-ember-modules-api-polyfill
) I am seeing the following error:The project does not use TypeScript, and is otherwise an up-to-date Ember 3.19 app.
The imports in
socket/service.js
are:The text was updated successfully, but these errors were encountered: