Webpack configuration, module.rules
:
{ test: /\.ts$/, include: projectRoot, exclude: /node_modules/, use: [ { loader: 'ts-loader', options: { appendTsSuffixTo: [/\.vue$/], }, }, ], }, { test: /\.tsx$/, include: projectRoot, exclude: /node_modules/, use: [ _.babelLoader, { loader: 'ts-loader', options: { appendTsSuffixTo: [/\.vue$/], }, }, ], },
Intellij Idea language injection for typescript block:
Example:
<template> <keep-alive> <router-view></router-view> </keep-alive> </template> <script lang="tsx" type="text/typescript"> import {Component, Watch, Prop} from 'vue-property-decorator'; import Vue from 'vue'; @Component export default class TestScreen extends Vue { created() { this.$root.subapp = this; } } </script>