remorses / vitro

Build and showcase your react components in isolation
https://vitro.now.sh
398 stars 12 forks source link

Error running vitro dev #10

Open frankandrobot opened 2 years ago

frankandrobot commented 2 years ago

I'm using a yarn workspaces monorepo, with the vitro workspace running inside components/pixi-components. However, when I run vitro dev from either inside this folder or via yarn workspace <workspace> vitro dev, I get the following errors:

vitro: 0.2.5 node: 16.13.0 & 16.13.1

ℹ Cannot resolve '@vitro/cli/reexports/inspect-mode.css' from '/Users/uri/Documents/robotandkid/components/pixi-components/vitro-virtual-index.jsx' during traversal, using yarn pnp: false
ℹ Cannot resolve '@vitro/cli/reexports/inspect-mode.css' from '/Users/uri/Documents/robotandkid/components/pixi-components/vitro-virtual-index.jsx' during traversal, using yarn pnp: false
 > vitro-virtual-index.jsx:1:7: error: Could not resolve "@vitro/cli/reexports/inspect-mode.css" (mark it as external to exclude it from the bundle)
    1 │ import '@vitro/cli/reexports/inspect-mode.css';

Update: this has nothing to do w/ monorepos! Just tried on a minimal hello-world repo and am getting the same error. It appears that vitro is broken

The package.json:

{
  "name": "sandbox2",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "react": "^17.0.2",
    "react-dom": "^17.0.2"
  }
}
frankandrobot commented 2 years ago

Update: I found a workaround! Install vitro as a package dependency (and not as a global dependency as the docs recommend)