You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a web component defined in a separate JavaScript file, you can include it in your MDX file by importing the script and adding a `<script>` tag with `type="module"`.
253
+
The script will be executed on the client side.
254
+
255
+
```js title="src/web-component.js"
256
+
classMyElextendsHTMLElement { ... }
257
+
customElements.define('my-el', MyEl);
258
+
```
259
+
260
+
```mdx title="src/Page.mdx"
261
+
importwebComponentfrom"./web-component.js?url";
262
+
263
+
<scriptsrc={webComponent}type="module"></script>
264
+
265
+
<my-el />
266
+
```
267
+
250
268
## Configuration
251
269
252
270
Once the MDX integration is installed, no configuration is necessary to use `.mdx` files in your Astro project.
0 commit comments