-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yarn workspaces support #225
Comments
also having this issue, is there any possibility to transpile node_modules ? |
@brunolemos It isn't error from docz and yes for the yarn workspace. |
I don't think so. Docz needs to prepare the webpack config for this, supporting multiple project roots. I don't know details, but here's an example of a PR: facebook/create-react-app#3741 |
For sure @brunolemos I agree with you that is related to docz instead of yarn. But, is not a "problem", is an architecture decision. It's not a good practice import from other packages in a monorepo without transpiling and since they will be in the About |
Anyone have a good workaround for this? |
See how https://github.com/smooth-code/smooth-ui work @aarshaw, they're using docz in a monorepo! |
Ended up using something similar to this ^ ...feels king of hacky but works Updated doczrc.js to the following: import path from 'path'
const modifyBundlerConfig = config => {
config.module.rules[0].include.push(path.join(__dirname, '..', 'SHARED_PACKAGE_NAME'))
return config
}
export default {
modifyBundlerConfig,
} |
UpdateI changed my export default {
title: "@hello/ui",
codeSandbox: false,
typescript: true,
modifyBundlerConfig: config => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: require.resolve("babel-loader"),
options: {
presets: [["react-app", { flow: false, typescript: true }]]
}
});
config.resolve.extensions.push(".ts", ".tsx");
return config;
}
}; Anybody having this issue when upgrading to v1? If I have a component inside of
My folder structure is like this:
Here are the relevant files if that helps! // packages/docs/doczrc.js
import path from "path";
export default {
title: "@hello/ui",
codeSandbox: false,
typescript: true,
modifyBundlerConfig: config => {
config.resolve.alias = Object.assign({}, config.resolve.alias, {
"@hello/ui": path.resolve(__dirname, "..", "ui")
});
return config;
}
} // packages/ui/index.tsx
import React from 'react';
export default props => <div {...props} />; // packages/docs/index.mdx
---
name: Getting Started
route: /
---
import MyComponent from "@hello/ui";
<MyComponent>Hello</MyComponent> |
Bug Report
Describe the bug
Compilation fail when importing components from another yarn workspace.
To Reproduce
docz
workspace and oneshared
workspaceshared
docz
Environment
Additional context/Screenshots
If I move the docz code to
shared
it will work. It only works if the components are in the same "project". If you try to import from another workspace it fails.If you setup docz in the root directory (outside all workspaces) it fails as well, but with another error.
doczrc.js
docz package.json
docz/src/index.mdx
The text was updated successfully, but these errors were encountered: