vite-plugin-md
vite-plugin-md copied to clipboard
Fail to build when importing frontmatter
Describe the bug
When trying to import { frontmatter } from component, it works fine in dev.
But when trying to build the project it fails with "Module has no exported member 'frontmatter'".
yarn run v1.22.19
$ vue-tsc --noEmit && vite build
src/App.vue:2:23 - error TS2614: Module '"./components/ArticleTest.md"' has no exported member 'frontmatter'. Did you mean to use 'import frontmatter from "./components/ArticleTest.md"' instead?
2 import ArticleTest, { frontmatter } from './components/ArticleTest.md'
~~~~~~~~~~~
Found 1 error in src/App.vue:2
error Command failed with exit code 2.
Even if I add this section to vite-env.d.ts :
declare module '*.md' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
import type { Frontmatter } from 'vite-plugin-md'
export const frontmatter: Frontmatter
}
Still refuse to build...
Reproduction
https://github.com/bicouy0/vue-md-frontmatter
System Info
System:
OS: Linux 5.10 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (8) x64 Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
Memory: 14.83 GB / 23.40 GB
Container: Yes
Shell: 5.1.4 - /bin/bash
Binaries:
Node: 16.16.0 - /usr/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 8.11.0 - /usr/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Browsers:
Chrome: 104.0.5112.79
Chromium: 103.0.5060.53
Firefox: 102.0
Used Package Manager
yarn
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guide.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a minimal reproducible of the bug.