Hello there I'm trying to solve a problem with my marked down custom components. I have a large number of markdown files as they were previously used in the Gatsby project. I would rather not have to include all of the custom components in every markdown file. I have been given to understand that you can pass custom components via the astro.config.mjs which will make them globally available to the markdown passer. Here is an example of my astro.config.mjs where I am trying to pass a component to handle introductions.
import { defineConfig } from 'astro/config';
import BlockIntroduction from '../src/components/BlockIntroduction/BlockIntroduction.astro'
// https://astro.build/config
export default defineConfig({
// Other configurations...
markdown: {
render: [
['@astrojs/markdown-remark', {
components: {
'block-introduction': BlockIntroduction
},
}],
],
},
});
The component looks like this:
---
// BlockIntroduction.astro
import style from './BlockIntroduction.module.sass'
---
<div data-testid="BlockIntroduction">
<h1>INTRODUCTION</h1>
<slot />
</div>
However I am getting the following error:
12:29:04 [ERROR] [config] Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
Stack trace:
Any help would be very much appreciated.
