`nextjs` workspace starter fails if `--empty` flag is used
coreyaus opened this issue Β· comments
Describe the bug
Following the instructions here to create a new Bit workspace using Next.js without pre-built components by applying the --empty
flag throws an error:
bit new nextjs workspace-name --default-scope my-org.my-scope --aspect frontend.nextjs/nextjs-env --empty
The error message says:
unable to import the following component(s): my-org.my-scope/apps/my-nextjs-app.
the remote scope "my-org.my-scope" was not found
Or if the org and scope you supply do exist then the error says this:
error: a component "my-org.my-scope/apps/my-nextjs-app" was not found
your workspace.jsonc has this component-id set. you might want to remove/change it.
The underlying issue appears to be this line in the nextjs-workspace-starter.ts
, where it adds the app to the workspace.jsonc
file even if the --empty
flag is used: https://bit.cloud/frontend/nextjs/templates/starters/~code/nextjs-workspace/nextjs-workspace-starter.ts#l50
Steps to Reproduce
-
Read the official instructions in the section titled "Start without pre-built components" here: https://bit.cloud/frontend/nextjs/docs/intro
-
Run the following command:
bit new nextjs bit-hello-world --env frontend.nextjs/nextjs-env --empty
Steps to fix
This line should not be inserted in the workspace.jsonc
if the --empty
flag is passed: https://bit.cloud/frontend/nextjs/templates/starters/~code/nextjs-workspace/nextjs-workspace-starter.ts#l50. There may be other changes needed. What's the best way to handle this, or put another way, how do other starters observe and apply that --empty
flag?
Thank you for reporting @coreyaus π Your solution was indeed really close to the fix. π
The issue is now resolved, feel free to try again with the latest version. π
Thanks Kostas - I can confirm that's now working as expected π Happy new year!