rollup / plugins

🍣 The one-stop shop for official Rollup plugins
MIT License
3.57k stars 567 forks source link

I don't know if this is a mistake #1737

Closed jxh150535011 closed 2 weeks ago

jxh150535011 commented 2 weeks ago

I want some modules in node.modules to be compiled using typescript instead of esbuild

plugins: [
  typescript({
    include: [
      "/Volumes/xx_module/src/**/*.ts",
    ],
  }),
]

I check the output format of the class file to determine if it is effective:

// invalid
export class xx extends xxBase {
}
__decorateClass([fn()], xx.prototype, "xxProp", 2);

The correct way to build the output through tlibs is as follows:

// valid
export class xx extends xxBase {
}
__decorate([
  fn(),
  __metadata("design:type", Array)
], xx.prototype, "xxProp", void 0);

I must add the above path to both tsconfig.json and typescript()'s include in order to obtain the correct result:


plugins: [
  typescript({
    include: [
      "/Volumes/xx_module/src/**/*.ts",
    ],
  }),
]

tsconfig.json

include: [
 "/Volumes/xx_module/src/**/*.ts",
]

I don't know what caused this