yarn dev 返回此错误。
WARNING in ./Js/App.vue?vue&type=script&lang=ts& 1:166-169
"export 'default' (imported as 'mod') was not found in '-!../node_modules/ts-loader/index.js!../node_modules/vue-loader/lib
/index.js??vue-loader-options!./App.vue?vue&type=script&lang=ts&'
@ ./Js/App.vue
@ ./Js/dashboard.ts
@ multi ./Js/dashboard.ts ./Sass/dashboard.scss
我正在使用带有打字稿的 vue。
这是我的 ts-config.json
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"allowJs": true,
"sourceMap": true,
"baseUrl": ".",
"types": ["webpack"],
"paths": {
"@/*": ["Js/*"]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
},
"include": ["Js/**/*.ts", "Js/**/*.vue", "Js/tests/**/*.ts"],
"exclude": ["node_modules"]}
这是我的 main.ts
import Vue from "vue";
import App from "./App.vue";
new Vue({
render: h => h(App)
}).$mount("#dashboard");
这是我的 app.vue
<template>
<div id="app">
<h1>hello world</h1>
</div>
</template>
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
@Component({
name: "App"
})
export class App extends Vue {}
</script>
如果我在 app.vue 中没有 ts 代码运行没问题。使用 app.vue 终端中的 ts 代码显示此错误并且未运行我的应用程序。