unbuild icon indicating copy to clipboard operation
unbuild copied to clipboard

decorators

Open huseeiin opened this issue 9 months ago • 7 comments

Describe the feature

ERROR: Transforming JavaScript decorators to the configured target environment ("es2020") is not supported yet

tsconfig.json:

{
	"compilerOptions": {
		"lib": ["ESNext", "DOM"],
		"target": "ESNext",
		"module": "ESNext",
		"strict": true,
		"exactOptionalPropertyTypes": true,
		"noUncheckedIndexedAccess": true,
		"esModuleInterop": true,
		"moduleResolution": "node",
		"noEmit": true,
		"skipLibCheck": true,
		"experimentalDecorators": true,
		"strictPropertyInitialization": false,
		"emitDecoratorMetadata": true
	}
}

Additional information

  • [ ] Would you be willing to help implement this feature?

huseeiin avatar Sep 04 '23 18:09 huseeiin

same..

colmugx avatar Sep 06 '23 14:09 colmugx

Hi, I don't know it's related but have you guys add tslib to dependencies? what is your typescript version?

sadeghbarati avatar Sep 06 '23 14:09 sadeghbarati

but it works in 1.2.1

colmugx avatar Sep 06 '23 14:09 colmugx

I also tried to build the module that used decoration and got the same error as above

OSpoon avatar Sep 22 '23 08:09 OSpoon

The same mistake, do you want to use babel to transfer the insurance first

hengshanMWC avatar Oct 19 '23 06:10 hengshanMWC

same mistake

zhangjiluo-com avatar Dec 19 '23 03:12 zhangjiluo-com

Workaround:

Create a build.config.ts with the following:

import { defineBuildConfig } from 'unbuild';

export default defineBuildConfig({
  rollup: {
    esbuild: {
      tsconfigRaw: {
        compilerOptions: {
          experimentalDecorators: true,
        },
      },
    },
  },
});

or add the following section to the package.json:

"unbuild": {
  "rollup": {
    "esbuild": {
      "tsconfigRaw": {
        "compilerOptions": {
          "experimentalDecorators": true
        }
      }
    }
  }
}

zsilbi avatar Feb 03 '24 10:02 zsilbi