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: closed
- Created 3 years ago
- Comments: 35 (22 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.
I updated to react to
19. The error persists. Updated to waku0.20.2and the error was gone. Sorry for not trying it at the time, I was a little busy. It seems that the problem was solved a long time ago. I think this can be closed.@himself65 It’s strange because the link I posted at the time with the monorepo as an example has the same version in
react,react-domandreact-dom-server-webpack.The diff that I see is:
exportsproperty inuipackagemoduleasnodenextin tsconfig ofwebpackageAnd maybe another thing. Maybe is something of this list?
It happens on DEV and PRD too.