-
The only solution I've found in this forum isn't up to date.
And here is the MDX file where I'm trying to import the component to re-use colors' variables:
And I have this kind of error in my console : |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I haven't looked at why combining the default and named export doesn't let you import the named export in MDX, but that error goes away if you declare them separately. export class ColorsComponent {}
export default ColorsComponent Here is a Stackblitz without that error, by splitting them: https://stackblitz.com/edit/github-cbqhye?file=src%2Fapp%2Fcolors%2Fcolors.component.ts,src%2Fapp%2Fcolors%2Fcolors.mdx&preset=node That doesn't fix the problem of what you are trying to do, though. You are referencing color variables, in a static way, that are not static. Those variables would only be available within a story that is initializing your component in an Angular app. It looks like you are just referencing css variables defined globaly, so you should be able to move the initialization of those variables to a function or class outside of the Angular component and use it independently from the Angular component or the MDX script. |
Beta Was this translation helpful? Give feedback.
I haven't looked at why combining the default and named export doesn't let you import the named export in MDX, but that error goes away if you declare them separately.
Here is a Stackblitz without that error, by splitting them: https://stackblitz.com/edit/github-cbqhye?file=src%2Fapp%2Fcolors%2Fcolors.component.ts,src%2Fapp%2Fcolors%2Fcolors.mdx&preset=node
That doesn't fix the problem of what you are trying to do, though. You are referencing color variables, in a static way, that are not static. Those variables would only be available within a story that is initializing your component in an Angular app. It looks like you are…