Enable hot module replacement (HMR) on your typescript vue components.
This loader is for Vue components written in .ts. If you are using .vue file, you don't need this loader.
This code is a based on vue-hot-reload-loader.
# NPM
$ npm install --save-dev vue-hot-typescript-loaderEnsure the webpack entry points for your debug build includes HMR code
module.exports = {
entry: {
app: [ 'webpack-hot-middleware/client', './src/app.ts']
}
}Update your webpack config to apply vue-hot-typescript-loader after initial compilation has occured
module.exports = {
module: {
rules: [{
test: /\.ts$/,
use: ['vue-hot-typescript-loader', 'ts-loader'],
include: path.resolve(__dirname, 'path/to/components')
}]
}
}Supports one class per file. As long as the class extends Vue and in turn is exported, it will be created with HMR support at runtime.
import * as Vue from 'vue';
export class MyComponent extends Vue {}import { default as VueAlias } from 'vue';
export class MyComponent extends VueAlias {}let vue = require('vue'); // commonjs import
class MyComponent extends Vue {}
export default MyComponent;This project is licensed under the MIT License - see the LICENSE file for details