用rollup打包vue组件时,出现这个错误:
rollup.config.js:
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "rollup-plugin-typescript2";
import vue from "rollup-plugin-vue";
import {babel} from '@rollup/plugin-babel';
import packageJson from "./package.json";
export default {
input: "src/index.ts",
output: [
{
format: "cjs",
file: packageJson.main,
sourcemap: true
},
{
format: "esm",
file: packageJson.module,
sourcemap: true
}
],
plugins: [babel(), peerDepsExternal(), resolve(), commonjs(), typescript(), vue()]
};
button.vue:
<template>
<button>button</button>
</template>
<script lang="ts">
</script>
有什么解决办法吗?