Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decorators throw Unexpected token '@'. #191

Open
selfagency opened this issue Aug 22, 2022 · 0 comments
Open

Decorators throw Unexpected token '@'. #191

selfagency opened this issue Aug 22, 2022 · 0 comments

Comments

@selfagency
Copy link

selfagency commented Aug 22, 2022

Hi! Am I missing something/doing something wrong that the plugin treats decorators as invalid syntax? Thanks!

Here's my config:

import tsConfigPaths from 'rollup-plugin-tsconfig-paths';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import ts from 'rollup-plugin-ts';

export default {
  input: 'lib/index.ts',
  output: {
    dir: 'dist',
    format: 'cjs',
  },
  plugins: [
    tsConfigPaths(),
    nodeResolve({extensions: ['.tsx', '.ts', '.jsx', '.js', '.json']}),
    ts({
      transpiler: 'swc',
      browserslist: false,
      swcConfig: {
        minify: true,
      },
    }),
  ],
};

And here's the output:

lib/index.ts → dist...
[!] (plugin Typescript) Error: 
  × Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key
    ╭─[/Users/daniel/code/unstoppable-domains-website/backend/lib/entities/FastlyCachableModel.ts:79:3]
 79 │ @AfterInsert()
    · ─
    ╰────

Caused by:
    0: failed to process input file
    1: Syntax Error


lib/entities/FastlyCachableModel.ts
Error: 
  × Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key
    ╭─[/Users/daniel/code/unstoppable-domains-website/backend/lib/entities/FastlyCachableModel.ts:79:3]
 79 │ @AfterInsert()
    · ─
    ╰────

Caused by:
    0: failed to process input file
    1: Syntax Error
@selfagency selfagency changed the title Decorators throw Unexpected token @. Decorators throw Unexpected token '@'. Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant