Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Yarn workspaces support #225

@brunolemos

Description

@brunolemos

Bug Report

Describe the bug

Compilation fail when importing components from another yarn workspace.

To Reproduce

  1. Create one docz workspace and one shared workspace
  2. Create components on shared
  3. Import them on docz
  4. See error
Module parse failed: Unexpected token (11:2)
You may need an appropriate loader to handle this file type.
| 
| export default () => (
>   <Touchable onPress={() => alert('pressed')}>
|     <Text style={styles.text}>Shared Button</Text>
|   </Touchable>

 @ ./src/index.mdx 9:0-61 66:93-99
 @ ./.docz/app/imports.js
 @ ./.docz/app/index.jsx
 @ multi ../node_modules/docz-core/node_modules/babel-polyfill/lib/index.js ./.docz/app/index.jsx

Environment

  • OS: macOS 10.14
  • Node/npm version: Node 8.11.3 / npm 5.6

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.

image

image

doczrc.js

module.exports = {
  themeConfig: {
    colors: {
      primary: 'black',
    },
  },
  typescript: true,
}

docz package.json

{
  "name": "docz",
  "version": "0.0.1",
  "scripts": {
    "start": "docz dev",
    "build": "docz build"
  },
  "dependencies": {
    "shared": "0.0.1"
  },
  "devDependencies": {
    "docz": "^0.10.2"
  }
}

docz/src/index.mdx

---
name: Hello world
---

import Button from 'shared/src/components/common/Button.tsx'

# Hello world

<Button>Click</Button>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions