
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
ts-vue-loader
Advanced tools
VueJS Typescript loader to enable HMR and VirtualDom when using Typescript
The goal of this loader is to enable HMR and Virtual Dom for VueJS Component written using .ts and vue-property-decorator
If you write your components like this
import { Vue, Component } from 'vue-property-decorator'
@Component({
template: `<div>Counter : {{ i }}</div>`
})
export default class Count1 extends Vue {
i: number = 0
timer?: number
mounted () {
this.timer = window.setInterval(() => {
this.i++
}, 1000)
}
destroyed () {
if (this.timer) {
window.clearInterval(this.timer)
}
}
}
This loader is for you !
First you have to install the loader
npm i -D ts-vue-loader
Then add the loader in your webpack configuration
// webpack.config.json
{
test: /\.tsx?$/,
use: ['ts-vue-loader', 'ts-loader']
},
And it should work. A demo project is available in the example directory.
There are two transformations done by this loader :
template: `<div>Counter : {{ i }}</div>`
is converted into :
render: function () { var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._v("Increment : "+_vm._s(_vm.i))])}
and this code is added at the end of your module
App.options.__file = '/home/john-doe/vue-ts-loader/example/src/components/App.ts'
if (module.hot) {(function () {
var hotApi = require('vue-hot-reload-api')
hotApi.install(require('vue'), false)
if (!hotApi.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotApi.createRecord('data-v-27f0d292', App)
} else {
hotApi.rerender('data-v-27f0d292', App)
}
})()}
The original Vue-loader is able to rerender components without loosing his state. Since it is quite tricky to detect what changed in your code, this loader will reload the whole component on every change. A good improvment could be to only trigger a rerender based what changed.
FAQs
VueJS Typescript loader to enable HMR and VirtualDom when using Typescript
The npm package ts-vue-loader receives a total of 95 weekly downloads. As such, ts-vue-loader popularity was classified as not popular.
We found that ts-vue-loader demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.