Node's Pastoral Musicians

    unplugin-vue-script-name
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.5 • Public • Published

    unplugin-vue-script-name

    NPM version

    Support <script name> for Vue script setup.

    Install

    npm i -D unplugin-vue-script-name
    Vite
    // vite.config.ts
    import scriptName from "unplugin-vue-script-name/vite";
    
    export default defineConfig({
      plugins: [
        scriptName({
          /* options */
        })
      ]
    });

    Example: playground/


    Rollup
    // rollup.config.js
    import scriptName from "unplugin-vue-script-name/rollup";
    
    export default {
      plugins: [
        scriptName({
          /* options */
        })
      ]
    };


    Webpack
    // webpack.config.js
    module.exports = {
      /* ... */
      plugins: [
        require("unplugin-vue-script-name/webpack").default({
          /* options */
        })
      ]
    };


    Nuxt
    // nuxt.config.js
    export default {
      buildModules: [
        [
          "unplugin-vue-script-name/nuxt",
          {
            /* options */
          }
        ]
      ]
    };

    This module works for both Nuxt 2 and Nuxt Vite


    Vue CLI
    // vue.config.js
    module.exports = {
      configureWebpack: {
        plugins: [
          require("unplugin-vue-script-name/webpack").default({
            /* options */
          })
        ]
      }
    };


    How It Works

    <!-- MyComponent.vue -->
    <script setup lang="ts" name="MyComponent">
      defineProps({
        title: { type: String }
      });
    </script>
    
    <template>
      <h1>{{title}}</h1>
    </template>
    <!-- Will be transformed to -->
    <script>
      export default { name: "MyComponent" };
    </script>
    
    <script setup lang="ts">
      defineProps({
        title: { type: String }
      });
    </script>
    
    <template>
      <h1>{{title}}</h1>
    </template>

    Install

    npm i unplugin-vue-script-name

    DownloadsWeekly Downloads

    1

    Version

    0.1.5

    License

    MIT

    Unpacked Size

    499 kB

    Total Files

    31

    Last publish

    Collaborators

    • soullyoko