title: Vue + Rollup: Unused vars error on build for plugin
body: <p><a href="https://i.stack.imgur.com/foqN7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/foqN7.png" alt="Error image" /></a></p>
  <p>I am building a plugin inside a Vue 3 installation in <code>src/plugin</code>. I am using RollupJS to build my plugin with rollup-plugin-vue to compile the Vue templates.<br />
  This is my plugin's entry point:<br />
  <code>index.js</code></p>
  <pre class="lang-js prettyprint-override"><code>import Test from './components/Test.vue'
  
  const install = (app) =&gt; {
      app.directive('testdirective', {
          mounted(el){
              el.style.background = &quot;orange&quot;
              el.style.padding = &quot;1em&quot;
          }
      })
  }
  
  export default install
  export {
      Test
  }
  </code></pre>
  <p>and the test vue file<br />
  <code>Test.vue</code></p>
  <pre class="lang-html prettyprint-override"><code>&lt;template&gt;
    &lt;div&gt;
        &lt;h1 v-testdirective&gt;Test Heading&lt;/h1&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  export default {
  }
  &lt;/script&gt;
  
  &lt;style&gt;
  
  &lt;/style&gt;
  </code></pre>
  <p><strong>Build configuration</strong><br />
  <code>rollup.config.js</code></p>
  <pre class="lang-js prettyprint-override"><code>import vue from 'rollup-plugin-vue'
  
  export default {
      input: 'src/index.js',
      output:[
          {
              file: 'dist/bundle.js',
              format: 'esm'
          }
      ],
      plugins:[
          vue()
      ],
      external: ['vue']
  }
  </code></pre>
  <p>I tried test code to see if the builds worked, but I am getting the error in <code>dist/bundle.js</code> (Image attached at top of this post)<br />
  Also, if I remove the empty script and style tags in <code>Test.vue</code> then I get only these errors:
  <a href="https://i.stack.imgur.com/2Git8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2Git8.png" alt="Test.vue error if no script or style" /></a></p>
  <p>But I will be needing those when I am actually building the plugin. I don't know how to fix this.</p>