Closed Mister-Hope closed 4 years ago
I have a look carefully and found vuepress-type
seems be the work around , but it is not dependent by vuepress-plugin-typescript
, so did you miss it in the package.json?
vuepress-types
is a experimental package and not necessary, so I didn't add it to the dependencies of vuepress-plugin-typescript
.
I'll update the documentation for this.
But after I add vuepress-types
, I am still catching problems like the sreenshot above.
But after I add
vuepress-types
, I am still catching problems like the sreenshot above.
You need to import it manually
Thanks, but how to import it? Do you mean like this? Or maybe in the tsconfig.json?
<script lang="ts">
import 'vuepress-types';
import Vue from 'vue';
export default Vue.extend({
props: {
html: { type: String, default: '' }
},
data: () => ({ location: '' }),
computed: {
copyright() {
const author = this.$themeConfig.author || this.$siteTitle;
const content = {
'zh-CN': `${this.html}\n-----\n著作权归${author}所有。\n链接:${location}`,
'en-US': `${this.html}\n-----\nCopyright by ${author}.\nLink: ${location}`
};
return content[this.$lang];
}
},
created() {
this.location = window.location;
}
});
</script>
The code above is still catching errors.
Have you installed vuepress-types
?
BTW, it's better to use vue-class-component
and vue-property-decorator
for better types checking
Documentation updated:
I still have a problems, I have vuepress-types
installed in the root folder (since I am using monorepo), then I got this
Uncaught Error: Cannot find module 'vuepress-types'
at webpackMissingModule (webpack-internal:///../node_modules/ts-loader/index.js?!../node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js?!../node_modules/vue-loader/lib/index.js?!../packages/components/src/BreadCrumb.vue?vue&type=script&lang=ts&:9)
at eval (webpack-internal:///../node_modules/ts-loader/index.js?!../node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js?!../node_modules/vue-loader/lib/index.js?!../packages/components/src/BreadCrumb.vue?vue&type=script&lang=ts&:9)
at Object.../node_modules/ts-loader/index.js?!../node_modules/@vuepress/core/node_modules/cache-loader/dist/cjs.js?!../node_modules/vue-loader/lib/index.js?!../packages/components/src/BreadCrumb.vue?vue&type=script&lang=ts& (app.js:2046)
at __webpack_require__ (app.js:770)
at fn (app.js:130)
at eval (webpack-internal:///../packages/components/src/BreadCrumb.vue?vue&type=script&lang=ts&:2)
at Module.../packages/components/src/BreadCrumb.vue?vue&type=script&lang=ts& (app.js:2761)
at __webpack_require__ (app.js:770)
at fn (app.js:130)
at eval (webpack-internal:///../packages/components/src/BreadCrumb.vue:3)
While vscode can found it.
❤️
I am catching problems about vuepress-types
.
Here is the errors, when I include it in my tsconfig.json
And here is the error I use import "vuepress-types"
The fist one only causes error on the console panel, but the website works well while the second one is not working.
I am sure vuepress-types is required as dependencies. I am not familiar how node and ts-loader handles a packages only have types
options declared.
I wounder if you can help me, thanks.
You can check the test cases.
If you still meet some problems, try to open a new issue and provide a reproduce repo
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Describe the bug
This will cause issue on the linter since the default
vue
object doesn't have a $themeConfig or $siteTitle property.