Possibility to change the order of @swc/helpers

Hello, I'm working on some legacy project that is using
ng-annotate
package.

I have a problem resulting from swc compilation, namely in the case of class definitions (and perhaps also in other situations that I have not encountered), the order of the JSDoc comment is shifted by placing the helper definition or helper import.

And this makes
ng-annotate
unable to process this structure. Furthermore, I suspect this state of affairs can also generate other problems, such as incorrect typing using jsdoc.

Is there any way to fix this bug, or force SWC to place these imports at the very top of the files rather than directly above the classes?

/** @ngInject */
class TestClass {
  constructor (private testField) {}
}

output:
/** @ngInject */ import { _ as _define_property } from "@swc/helpers/_/_define_property";
class TestClass {
    constructor(testField){
        _define_property(this, "testField", void 0);
        this.testField = testField;
    }
}

My config:
{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false,
      "decorators": true
    },
    "target": "es2015",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    },
    "transform": {
      "decoratorVersion": "2022-03"
    },
    "preserveAllComments": true,
    "externalHelpers": true
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": true
}
Was this page helpful?