Skip to content

Docs: Theming instructions should work with Yarn Workspaces #3674

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ravgoundar opened this issue Jun 18, 2019 · 5 comments
Closed

Docs: Theming instructions should work with Yarn Workspaces #3674

ravgoundar opened this issue Jun 18, 2019 · 5 comments

Comments

@ravgoundar
Copy link

Steps

I have followed the instructions to set up theming with Create React App. My app is set up using the following structure using Yarn Workspaces:

| app
--| node_modules
--| packages
----| web
------| semantic-ui
------| craco.config.js

Expected Result

Theme variables and overrides should work the way they do when not using Yarn Workspaces.

Actual Result

semantic-ui-less in the Workspace root folder does not read the theme overrides set in the web folder. It does work if I copy the semantic-ui-less folder from app/node_modules and paste into app/packages/web/node_modules. However, this folder is deleted whenever I run yarn install.

Version

"semantic-ui-less": "^2.4.1"

@ghost ghost added the triage label Jun 18, 2019
@welcome
Copy link

welcome bot commented Jun 18, 2019

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@layershifter
Copy link
Member

Yarn Workspaces and actually monorepo setup are exclusions for a common use case and I am not sure that we should cover it in regular docs 🤔

@layershifter layershifter changed the title [React] Theming instructions should work with Yarn Workspaces Docs: Theming instructions should work with Yarn Workspaces Jun 22, 2019
@JamesYFC
Copy link

JamesYFC commented Aug 29, 2019

To fix this, you could use the nohoist property of yarn workspaces, which keeps the package in the relevant child project's node_modules rather than the root's:

For example, this is the workspaces part of my updated root package.json:

"workspaces": {
    "packages": ["my-app"],
    "nohoist": ["my-app/fomantic-ui-less"]
}

(use "**/fomantic-ui-less" if you need it to work in every package)

Then delete your node_modules folder and run yarn install.

@layershifter It would be great if we could get at least a small note in the docs for this case to save users debugging time, especially seeing as workspaces has been out for a while now and use of monorepos seems to be on the rise.

@calbrecht
Copy link

Found out you don't need to nohoist and copy. Just prefix more ../ followed by the package you are developing.

@brianespinosa
Copy link
Member

Closing this issue for now. Technically CRA is still not supported in a monorepo configuration. It is possible... I do this in a number of monorepo projects... but it requires a lot of understanding of the build pipeline. And since it is not supported by CRA, these configurations could break at any time.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

5 participants