'Use Reflect Metadata with Nx + Storybook?
Hi I'm trying to figure out how to get Reflect Metadata to work in an Nx Lib space that uses storybook.
Nx by itself can generate a lib and also generate a storybook configuration out of the box using nx
However when using the code syntax Reflect.defineMetadata() in one of the files down the dependency tree. The serving storybook no longer works (with very little error messages : /).
I'm able to fix this by adding import 'reflect-metadata'; in the file using Reflect.defineMetadata() . However I know that import 'reflect-metadata' should only be imported once and doing this will pollute my source files. Is there a storybook file that serves as an entry point to the serve build?
For example the Jest Testing framework allows me to add import 'reflect-metadata' in a jest.setup.ts file which can be used in all my test.
Refs:
Nx Storybook: https://nx.dev/storybook/overview-angular.
Reflect Metadata: https://www.npmjs.com/package/reflect-metadata
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
