Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed Nov 25, 2023
1 parent c3e936a commit a9dbbc8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ function swc(options: PluginOptions = {}): RollupPlugin {
? {}
: getOptions(this, dirname(id), options.tsconfig);

let enaleExperimentalDecorators = false;
let enableExperimentalDecorators = false;
if (isTypeScript) {
try {
const packageJsonPath = require.resolve('typescript/package.json', { paths: [process.cwd()] });
const { version } = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
const [major] = version.split('.');
// typescript 5.x
if (+major >= 5) enaleExperimentalDecorators = true;
if (+major >= 5) enableExperimentalDecorators = true;
} catch {
this.warn({
message: 'Failed to find TypeScript. Please check if TypeScript has been installed.',
Expand All @@ -133,12 +133,12 @@ function swc(options: PluginOptions = {}): RollupPlugin {
parser: {
syntax: isTypeScript ? 'typescript' : 'ecmascript',
[isTypeScript ? 'tsx' : 'jsx']: isTypeScript ? isTsx : isJsx,
decorators: enaleExperimentalDecorators || tsconfigOptions.experimentalDecorators
decorators: enableExperimentalDecorators || tsconfigOptions.experimentalDecorators
},
transform: {
decoratorMetadata: tsconfigOptions.emitDecoratorMetadata,
// @ts-expect-error -- swc types loose this :(
decoratorVersion: enaleExperimentalDecorators ? '2022-03' : '2021-12',
decoratorVersion: enableExperimentalDecorators ? '2022-03' : '2021-12',
react: {
runtime: useReact17NewTransform
? 'automatic'
Expand Down

0 comments on commit a9dbbc8

Please sign in to comment.