CanJS 4 Migration questions


I recently updated our ‘example’ application from CanJS 3 to CanJS 4. In general it went well and didn’t take very long but I have some questions.

Firstly, I had to remove can-define-backup. The current version in npm is 0.0.1. I was getting an error about an incompatibility

Error: You can't have two versions of can-dom-data-state, check your dependencies

I only get this error is I import can-define-backup

Secondly, I have been using the can-validate-validatejs package in the CanJS 3 version of this example application. This still works, but I see that there is now a can-define-validate-validatejs package. Should I use this package now?

Thats all for now. Thanks in advance.


Rob, can you create an issue for can-define-backup? We should be able to get a fix out soon.

@robfoweraker can-define-backup@1.0 has been published.

The API is now mixin-based, so to use it you need to call the function on your Map:

import DefineMap from "can-define/map/map";
import defineBackup from "can-define-backup";

const recipe = new DefineMap( "Recipe", {
    title: "Pancake Mix"
} );

The documentation will be added to shortly and I will also update the migration guide with this info.

1 Like

@phillipskevin Thanks! I will try it out and report back - probably next week.

1 Like