Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

196
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda