Quiero intentar acumular una biblioteca de componentes vue. Pero obtuve el error en mi verificación de tipo. Intenté actualizar el mecanografiado como se mencionó aquí , pero no funcionó. aquí está mi código y package.json Mi código de componente que se ha exportado como un Button
<template> button >{{ children }}</button> </template> <script lang="tsx"> declare type IconMode = | { iconMode?: "without-icon"; } | { iconMode: "with-icon" | "icon-only"; iconName: string; }; ... </script>y rollup.config.js es:
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() ] };Pero tengo este error en la 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)Estaré agradecido si usted me puede ayudar.
el problema es que @rollup/plugin-typescript desinstala @rollup/plugin-typescript e instala rollup-plugin-typescript2 en su lugar.