Describe the bug
When installing [email protected] using yarn, one sees the following warning:
warning Workspaces can only be enabled in private projects.
The warning only occurs if webpack-cli is being resolved for the first time (meaning it is not yet in the yarn.lock file).
To Reproduce
Steps to reproduce the behavior:
mkdir new-project
cd new-project
yarn init -y
yarn add webpack webpack-cli --dev
See warning.
Expected behavior
No such warning should show. I thought there was an error with my own workspace (which uses webpack-cli).
Additional context
webpack-cli should be just another package inside packages. It should have its own package.json without the "workspaces" field, which causes the warning on user-end.
The root package.json should be "private": true and contain the "workspaces" key. It should not be published.
Using latest [email protected].
Could you do a PR?
Changing the entire project setup and moving stuff around requires better level of familiarity with the current setup/scripts/lifecycle/ci/tooling.
Instead, I made a PR to just remove the "workspaces" key, as it is not really used. It should fix the warning on user end.
@ev1stensberg
okay great. That's what I was hoping for as well. CLI shouldn't be a private package. Thanks for having a look!
Just to clarify, the broader intention was to move the webpack-cli to a cli folder inside packages, with its own (non-private) package.json.
In a yarn workspace project, the root package.json is just a common, private, one.
This is just not a yarn workspace. Its a lerna bootstraped one.
CC-ing @sendilkumarn , he knows more about this than me. And yes, if the package remains webpack-cli, I'm in favor.
Alternatively, "npmClient": "yarn" and "useWorkspaces": true could be set in lerna.json and "private": true set in package.json to leverage yarn workspaces hoisting node modules.
Most helpful comment
Alternatively,
"npmClient": "yarn"and"useWorkspaces": truecould be set inlerna.jsonand"private": trueset inpackage.jsonto leverage yarn workspaces hoisting node modules.