Assertion Failed with Embroider
zion03 opened this issue · comments
Environment
Ember: 3.23.1
Ember Data : 3.23.0
Embroider: 0.35.0
Steps to Reproduce
Build app with Embroider and problem here owner.factoryFor
when validating
Uncaught Error: Assertion Failed: Validator not found of type: presence.
I'm also seeing this. In my testing it works fine in Embroider's "Safe" mode which is the mode that offers most backwards compatibility with existing Ember apps. The error seems to occur when Embroider's "Optimized" mode is enabled, i.e. tree-shaking turned on.
I have a sample app repo which exhibits the problem. Just load the app and open the homepage, it throws the following error in the console
vendor.js:20816 Error while processing route: index Assertion Failed: Validator not found of type: presence. Error: Assertion Failed: Validator not found of type: presence.
at Object.assert (http://localhost:7020/assets/vendor.js:33429:15)
at validate (webpack:///./node_modules/ember-validators/index.js?:7:52)
at Class.validate (webpack:///./node_modules/ember-cp-validations/-private/ember-validator.js?:8:83)
at eval (webpack:///./node_modules/ember-cp-validations/validations/factory.js?:377:24)
at eval (webpack:///./node_modules/ember-cp-validations/validations/factory.js?:463:15)
at Array.map (<anonymous>)
at generateValidationResultsFor (webpack:///./node_modules/ember-cp-validations/validations/factory.js?:441:21)
at Class.eval (webpack:///./node_modules/ember-cp-validations/validations/factory.js?:376:29)
at Class.eval (webpack:///./node_modules/ember-cp-validations/utils/cycle-breaker.js?:21:17)
at http://localhost:7020/assets/vendor.js:12259:25
You can see the validations I added by viewing this commit. They are essentially the ones from the basic ember-cp-validations example in the docs.
@snewcomer Hello, I saw you fix ember-validators (version 4.0.0). Can you please bump dependency here (ember-cp-validations) to support embroider?
@offirgolan @snewcomer Can you please update ember-validators dependency for making it embroider treeshaking compatible?