Skip to content

Migration to native javascript classes - remove the @classic decorator #909

@svogt0511

Description

@svogt0511

After running the ember upgrade command, on 'yarn start', then on page display, there are complaints that look like they are caused by using the @classic decorator. We need to remove the @classic decorator from all classes and instead use native javascript classes, which is part of the 'classic' => 'octane' migration, and I think was ok up until ember 5.0. Complaints such as:

yarn start
yarn run v1.22.22
$ ./node_modules/.bin/ember serve
WARNING: Ember CLI v5.0.0 is not tested against Node v20.18.0. See "https://github.com/ember-cli/ember-cli/blob/master/docs/node-support.md" to find out which version of Node is best to use.
⠏ building... [ember-auto-import-analyzer]Warning: ignoring input sourcemap for vendor/fake-xml-http-request/fake_xml_http_request.js because ENOENT: no such file or directory, open '/tmp/broccoli-3255127G1cOSL94pLSz/out-753-broccoli_debug_debug_6_vendor_js/vendor/fake-xml-http-request/fake_xml_http_request.js.map'
Build successful (24272ms) – Serving on http://localhost:4200/
Slowest Nodes (totalTime >= 5%)                                                           | Total (avg)           
------------------------------------------------------------------------------------------+-----------------------
ember-auto-import-webpack (1)                                                             | 16618ms               
App is being served by FastBoot
/tmp/broccoli-3255127G1cOSL94pLSz/out-789-broccoli_merge_trees/assets/vendor.js:60884
  IS_PERMA_CLASSIC.set(_Ember.Location, false);
                   ^
TypeError: Invalid value used as weak map key
    at WeakMap.set (<anonymous>)
    at /tmp/broccoli-3255127G1cOSL94pLSz/out-789-broccoli_merge_trees/assets/vendor/classic-decorator/index.js:25:1
    at /tmp/broccoli-3255127G1cOSL94pLSz/out-789-broccoli_merge_trees/assets/vendor/classic-decorator/index.js:191:1
    at Script.runInContext (node:vm:149:12)
    at Sandbox.runScript (/home/suzanne/__WORK_WHIRLWIND/DATACITE/git/bracco/node_modules/fastboot/src/sandbox.js:57:12)
    at EmberApp.buildApp (/home/suzanne/__WORK_WHIRLWIND/DATACITE/git/bracco/node_modules/fastboot/src/ember-app.js:162:15)
    at /home/suzanne/__WORK_WHIRLWIND/DATACITE/git/bracco/node_modules/fastboot/src/ember-app.js:143:22
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at EmberApp.getNewApplicationInstance (/home/suzanne/__WORK_WHIRLWIND/DATACITE/git/bracco/node_modules/fastboot/src/ember-app.js:213:17)
    at EmberApp._visit (/home/suzanne/__WORK_WHIRLWIND/DATACITE/git/bracco/node_modules/fastboot/src/ember-app.js:244:9)
    at EmberApp.visit (/home/suzanne/__WORK_WHIRLWIND/DATACITE/git/bracco/node_modules/fastboot/src/ember-app.js:329:7)
    at FastBoot.visit (/home/suzanne/__WORK_WHIRLWIND/DATACITE/git/bracco/node_modules/fastboot/src/index.js:86:18)
    at /home/suzanne/__WORK_WHIRLWIND/DATACITE/git/bracco/node_modules/fastboot-express-middleware/src/index.js:33:20

seem to be caused by the @classic decorator. 2 things to do to get past this:

  • Make sure all classes are native javascript
  • Update the linter and run it to help verify all classes have been converted to native javascript.

Resources:

Also see the Technical Spec and Implementation Notes.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions