waku: fail to resolve packages imported from another package in a monorepo
file located in monorepo/ui/components/Example/Example.tsx
import stylex from "@stylexjs/stylex"
const styles = stylex.create({
base: {
borderRadius: 40,
},
})
export const Example = () => {
return (
<div {...stylex.props(styles.base)}>
<h1>Example</h1>
</div>
)
}
file located in monorepo/web/src/root-layout.tsx
import { Example } from "@my-org/ui/components/Example/Example"
import stylex from "@stylexjs/stylex"
const styles = stylex.create({
base: {
padding: 10,
},
})
export const RootLayout = async ({ children }: RootLayoutProps) => {
return (
<div id="__waku">
<Header />
<main>
<Example />
<div {...stylex.props(styles.base)}>
{children}
</div>
</main>
<Footer />
</div>
)
}
When load the page in browser I get the follow error:
Error: Error: Failed to load url ../../@stylexjs/stylex (resolved id: ../../@stylexjs/stylex) in ...
In this example I use stylex but It occurs with any external packages. The external package in the same package works but if it is loaded from another package in the same monorepo then it fails with that message error.
About this issue
- Original URL
- State: open
- Created 5 months ago
- Comments: 26 (20 by maintainers)
While I was preparing a repo for you to try, I already know what causes it. In the
tsconfig.jsonof the the package consumed (in this example,ui) by the other package (in this example,web) is set the propertybaseUrlto".". The tsconfig.json is:If you want the repository anyway, tell me and I’ll upload it.
It happens on DEV and PRD too.