
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
rollup-plugin-ts-vue
Advanced tools
Note: Version 0.6.0 covers updated NPM packages due to Github's security advisory. !! Use at your own risk !!
Plugin for Rollup to bundle Vue components written in TypeScript.
This plugin was in inspired by rollup-plugin-typescript, which uses Typescript's API. Added support for SCSS and Vue.
Feel free to use my full boilerplate project here on Github.
Why another plugin?? I love writing in Typescript and love the Vue single component concept. However, the similar plugins rely on other tools to complete the job. Wanted a way to reduce over-head of other tool-sets like; Babel, Webpack, etc. and replace with a simpler tool.
NOTE: currently
scopedstyles are partially supported and in-beta. Work-in-Progress
import resolve from "./node_modules/@rollup/plugin-node-resolve/dist/index.es";
import vue from "./node_modules/rollup-plugin-ts-vue/dist/rollup-plugin-ts-vue.es";
export default {
input: "./src/main.ts",
output: {
name: "app",
format: "iife",
file: "./dist/js/app.js",
globals: {
"vue": "Vue",
"vue-router": "VueRouter",
"vuex": "Vuex",
"vue-property-decorator": "VueClassComponent",
"vue-class-component": "VueClassComponent"
"axios": "axios"
},
sourcemap: true,
sourcemapFile: "./dist/js/app.js.map"
},
plugins: [
resolve(),
// null == defaults to tsconfig.json
vue(null, {
output: "./dist/css/site.css",
includePaths: ["src/scss"]
})
],
external: [
"vue",
"vue-router",
"vuex",
"vue-class-component",
"axios"
]
}
Standard Vue Mixin Object
<template>
<div>{{msg}}</div>
</template>
<script lang="ts">
import Vue, { ComponentOptions } from "vue";
export default {
data() {
return {
msg: "Hello World",
};
},
} as ComponentOptions<any>;
</script>
<style lang="scss"></style>
Vue Extend
<template>
<div>{{msg}}</div>
</template>
<script lang="ts">
import Vue from "vue";
export default Vue.extend({
data() {
return {
msg: "Hello World",
};
},
created() {
let vm = this as VueComp;
vm.msg = "Hello World Too!!";
},
});
interface VueComp extends Vue {
msg: string;
}
</script>
<style lang="scss">
$myColor = blue;
div {
color: $myColor;
}
</style>
vue-property-decorator
<template>
<div>{{msg}}</div>
</template>
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
@Component({
name: "component-template"
})
export default class ComponentTemplate extends Vue {
msg: string = "Hello World";
created() {
this.msg = "Hello World Too!!";
console.log(Created: life-cycle hook);
}
}
</script>
<style lang="scss">
div {
color: blue;
a {
color: green;
}
}
</style>
When using paths in tsconfig, rollup doesn't understand how to translate so it may resolve the module. When using something like this; import MyMod from "@/components/my-module". Rollup will assuming its an external dependencies. This plugin will attempt to resolve and correct the module path before passing to Rollup.
tsconfig.json
{
...
"baseUrl": ".",
"paths": {
"@/*": [ "src/*" ]
}
...
}
sass compiler into project vs using another plugin. Also switch from node-sass to sass due to tar@2.0 errors.FAQs
Vue bundler with Typescript and Rollup
The npm package rollup-plugin-ts-vue receives a total of 3 weekly downloads. As such, rollup-plugin-ts-vue popularity was classified as not popular.
We found that rollup-plugin-ts-vue demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.