Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
Error: Unexpected token (Note that you need plugins to import files that are not JavaScript) rollup vue package

I wanna try to rollup a vue component library. But I got the error on my type checking. I try to update typescript as here has been mentioned but it didn't work. here is my code and package.json My component code which has been exported as a Button

 <template>
  button
    >{{ children }}</button>
</template>

<script lang="tsx">

declare type IconMode =
  | {
      iconMode?: "without-icon";
    }
  | {
      iconMode: "with-icon" | "icon-only";
      iconName: string;
    };
 ...
 </script>

and rollup.config.js is:

import commonjs from "@rollup/plugin-commonjs"; 
import vue from "rollup-plugin-vue"; 
import buble from "@rollup/plugin-buble"; 
import typescript from "@rollup/plugin-typescript";


export default {
  input: "src/index.ts",
  output: {
    name: "Button",
    exports: "named"
  },
  plugins: [
    typescript(),
    vue({
      css: true, 
      compileTemplate: true 
    }),
    commonjs()
  ]
};

But I got this error on the terminal:

[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
src/Components/Button.vue?vue&type=script&lang.tsx (18:8)

18  declare type IconMode =
            ^ 
Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)

I'll be thankful if you could help me.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

the problem is with the @rollup/plugin-typescript uninstall @rollup/plugin-typescript and install rollup-plugin-typescript2 instead.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!