embroider: `import moment` Error - only during `embroider-safe` scenario on `Ember 4.12` addon (v1)
Hello,
I have the following setup in my ember-addon (v1) :
"devDependencies": {
.....,
...,
"@babel/core": "^7.22.1",
"@babel/eslint-parser": "^7.21.8",
"@babel/plugin-proposal-decorators": "^7.21.0",
.....,
...,
"@embroider/test-setup": "^3.0.0", // I have no other @embroider dependencies explicitly defined
.....,
...,
"ember-auto-import": "^2.6.3",
.....,
...,
"ember-source": "~4.12.0",
.....,
...,
"webpack": "^5.87.0",
.....,
...
},
"resolutions" :{
"@embroider/macros": "^1.12.2"
}
All of my automated tests (Acceptance, Integration, etc.) are passing in the default scenario ✅
But the embroider-safe test scenario (ember-try) is throwing these 2 errors ❌ :
qunit_parameterize__WEBPACK_IMPORTED_MODULE_7___default(...) is not a functionError: Could not find module moment imported from (require)
These errors are thrown due to these imports :
import moment from 'moment'import { cases } from 'qunit-parameterize'
Note:
@embroider/test-setupwas updated fromv2tov3byember-cli-update --- to 4.12and if I donwgrade it to v2 afterwards myself, the embroider-safe scenario throwsTypeError: this.macrosConfig.packageMoved is not a functioneven before it starts executing tests- I had to pin
"@embroider/macros": "^1.12.2"inresolutionsotherwise I get @babel errors when runningember serveeven in the default scenario.
About this issue
- Original URL
- State: open
- Created 10 months ago
- Comments: 17 (1 by maintainers)
I suspect there is a bug somewhere with detecting which packages are allowed to be imported when a v1 addon has a peer dep declared, so I think this is a valid issue
does it work if you put it under dependencies instead? (the way you have it, I would consider the correct way to have it configured)
Looking at the published qunit-parameterize 0.4.0, it doesn’t contain any default entrypoint. And the code it does contain doesn’t export any name like
cases.Perhaps you added some custom configuration to autoImport to make that work? If so, you’ll need to also add that kind of custom configuration to embroider.