Module alias for imports in main.ts
file
#22851
Unanswered
ernestostifano
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, I'm facing an issue when trying to import a package of my monorepo inside the
main.ts
file:The problem is that, by default, this only works when the
@my-monorepo/some-package
package is built.(
ERR! Error: Qualified path resolution failed: we looked for the following paths, but none could be accessed.
)Now, this might seem a dumb question, but the whole purpose of that function is to make Storybook HMR work when the internal packages of the monorepo are not built, and it works! (by using Webpack aliases to redirect imports to the source code of the imported packages).
But, obviously, the
main.ts
file is not processed in the same way as the other files (manager/preview), so is there a way to pass an option to whatever tool you are using to process themain.ts
file so I can tell it where to find the source code of the imported package?For example, if you are using TypeScript, I could use
compilerOptions.paths
.Because this is forcing me to build the packages each time I want to start Storybook, only for that function. Everything else works perfectly without building anything (because of Webpack aliases).
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions