doczjs/docz-plugin-css

TypeError: setArgs is not a function

Maycon-Santos opened this issue · 6 comments

I'm getting this error when trying to run yarn docz dev:

UNHANDLED REJECTION setArgs is not a function

  TypeError: setArgs is not a function

  - parseConfig.js:5 getDoczConfig
    [calendar]/[gatsby-theme-docz]/lib/utils/parseConfig.js:5:20

  - gatsby-config.js:36 module.exports.opts
    [calendar]/[gatsby-theme-docz]/gatsby-config.js:36:18

  - index.js:73 resolveTheme
    [calendar]/[gatsby]/dist/bootstrap/load-themes/index.js:73:19

  - From previous event:

  - From previous event:

  - index.js:137 module.exports
    [calendar]/[gatsby]/dist/bootstrap/load-themes/index.js:137:33

  - index.js:158 module.exports
    [calendar]/[gatsby]/dist/bootstrap/index.js:158:27

  - next_tick.js:68 process._tickCallback
    internal/process/next_tick.js:68:7


not finished open and validate gatsby-configs - 1.260s
doczrc.js
import { css } from 'docz-plugin-css'

export default {
  files: 'src/docs/**/*.{md,markdown,mdx}',
  typescript: true,
  plugins: [
    css({
      preprocessor: 'postcss',
      cssmodules: true,
    }),
  ],
}

I'm using Lerna in this monorepo project.

package.json
{
  "name": "root",
  "private": true,
  "scripts": {
    "start": "start-storybook -p 6006",
    "build-storybook": "build-storybook",
    "deploy-storybook": "storybook-to-ghpages && git clean -f -d",
    "test": "jest",
    "prepublishOnly": "yarn build",
    "prerelease": "yarn build",
    "release": "lerna publish",
    "build": "yarn build:es && yarn build:declaration",
    "build:es": "lerna exec -- babel src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
    "build:declaration": "lerna exec -- tsc --project ./tsconfig.build.json"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{ts,tsx}": [
      "eslint --fix",
      "prettier-standard",
      "jest --bail --findRelatedTests"
    ]
  },
  "workspaces": [
    "packages/*"
  ],
  "devDependencies": {
    "@babel/cli": "^7.8.4",
    "@babel/core": "^7.9.0",
    "@babel/plugin-proposal-class-properties": "^7.8.3",
    "@babel/plugin-transform-modules-commonjs": "^7.9.0",
    "@babel/preset-env": "^7.9.0",
    "@babel/preset-react": "^7.9.4",
    "@babel/preset-typescript": "^7.9.0",
    "@storybook/addon-actions": "^5.3.17",
    "@storybook/addon-info": "^5.3.17",
    "@storybook/addon-links": "^5.3.17",
    "@storybook/addons": "^5.3.17",
    "@storybook/react": "^5.3.17",
    "@storybook/storybook-deployer": "^2.8.3",
    "@testing-library/jest-dom": "^5.3.0",
    "@testing-library/react": "^10.0.1",
    "@testing-library/react-hooks": "^3.2.1",
    "@types/jest": "^25.1.4",
    "@types/testing-library__jest-dom": "^5.0.2",
    "@typescript-eslint/eslint-plugin": "^2.25.0",
    "@typescript-eslint/parser": "^2.25.0",
    "babel-jest": "^25.2.4",
    "babel-loader": "^8.1.0",
    "babel-plugin-css-modules-transform": "^1.6.2",
    "husky": "^4.2.3",
    "jest": "^25.1.0",
    "lerna": "^3.20.2",
    "prettier-standard": "^16.2.1",
    "react-docgen-typescript-loader": "^3.7.1",
    "react-test-renderer": "16.9.0",
    "ts-jest": "^25.2.1",
    "ts-loader": "^6.2.1",
    "typescript": "^3.8.3"
  },
  "dependencies": {
    "css-loader": "^3.4.2",
    "eslint-plugin-react": "^7.19.0",
    "postcss-cssnext": "^3.1.0",
    "postcss-loader": "^3.0.0",
    "style-loader": "^1.1.3"
  }
}
package/react-nice-calendar/package.json
{
  "name": "react-nice-calendar",
  "version": "0.1.6",
  "main": "lib/index.js",
  "types": "typings/index.d.ts",
  "author": {
    "name": "Maycon Santos",
    "email": "mayconsantos.dev@gmail.com",
    "url": "https://github.com/Maycon-Santos"
  },
  "license": "MIT",
  "private": false,
  "dependencies": {
    "calendar-provider": "^0.1.0",
    "core-js": "^3.6.5",
    "transition-engine": "^0.2.2"
  },
  "keywords": [
    "calendar",
    "date",
    "date-picker",
    "react"
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/Maycon-Santos/calendar.git"
  },
  "peerDependencies": {
    "react": ">=16.13.1",
    "react-dom": ">=16.3"
  },
  "devDependencies": {
    "docz": "^2.3.1",
    "docz-plugin-css": "^0.11.0"
  }
}

I also encountered the same problem, how to solve it

Me too

This plugin breaks on v2 (see here). Instead use gatsby-plugin-postcss.

Note that paths in gatsby-config.js are relative to ./.docz instead of the project root so adjust your configurations accordingly.

Its breaking in monorepo

setArgs is not a function

  TypeError: setArgs is not a function
  
  - parseConfig.js:5 getDoczConfig
    [emcm-dev-version]/[gatsby-theme-docz]/lib/utils/parseConfig.js:5:20
  
  - gatsby-config.js:36 theme
    [emcm-dev-version]/[gatsby-theme-docz]/gatsby-config.js:36:18
  
  - index.js:67 resolveTheme
    [emcm-dev-version]/[gatsby]/src/bootstrap/load-themes/index.js:67:19
  
  - index.js:120 
    [emcm-dev-version]/[gatsby]/src/bootstrap/load-themes/index.js:120:24
  

not finished open and validate gatsby-configs - 2.405s

image
is not the "docz-core" package problem?

I installed the "docz-core" package,then it can run.
image
image