How can I import a markdown file from /assets?

I've got a markdown file named "CHANGELOG.md" in my /assets folder that I want to import using typescript.

* I added declare module "*.md"; to global.d.ts so Typescript will accept it in imports.
* I've added import changelog from '~/assets/CHANGELOG.md'; to my file /pages/changelog.vue.
* I've added vite: { assetsInclude: ['**/*.md'] } to my nuxt.config.js.

This gives me the following error: Loading module from “https://tapp.docker.dev/_nuxt/assets/CHANGELOG.md?import” was blocked because of a disallowed MIME type (“text/html”)

I also tried to get this working using CodeSandbox or Stackblitz, but they fail already when I add the change to nuxt.config.js: https://stackblitz.com/edit/github-zjjjbk?file=nuxt.config.ts

How can I use .md files from my assets folder?
StackBlitzH.J. van Meerveld
Create a new Nuxt project, module, layer or start from a theme with our collection of starters.
Nuxt - Starter - StackBlitz
Was this page helpful?