zingchart / zingchart-react

Quickly create dynamic JavaScript charts with ZingChart & React.
https://www.zingchart.com/docs/integrations/react
MIT License
91 stars 24 forks source link

Export 'zingchart' is not defined (448:21) #22

Closed RomanKontsevoi closed 4 years ago

RomanKontsevoi commented 4 years ago

Hi, I've updated zingchart-react from v1.0.6 to v2.1.2, and have an error during compilation:

Failed to compile.

./node_modules/zingchart-react/dist/zingchart-react.es.js
SyntaxError: /Users/romankontsevoi/Documents/anm.pa.webapp/node_modules/zingchart-react/dist/zingchart-react.es.js: Export 'zingchart' is not defined (448:21)

  446 | 
  447 | export default ZingChart;
> 448 | export { ZC$2 as ZC, zingchart };
      |                      ^
  449 | //# sourceMappingURL=zingchart-react.es.js.map
  450 | 
    at parser.next (<anonymous>)
    at normalizeFile.next (<anonymous>)
Compiling...

my package.json file:

`{
  "name": "webapp",
  "version": "1.0.0",
  "private": true,
  "devDependencies": {
    "babel-plugin-import": "^1.7.0",
    "body-scroll-lock": "^3.0.2",
    "bootstrap-sass": "^3.3.7",
    "eslint-config-airbnb": "^18.1.0",
    "eslint-config-react-app": "^5.2.1",
    "eslint-plugin-flowtype": "^5.1.3",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^6.0.2",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-react": "^7.4.0",
    "flow-bin": "^0.125.1",
    "flow-typed": "^3.1.0",
    "husky": "^4.2.5",
    "lint-staged": "^10.2.7",
    "node-sass-chokidar": "1.4.0",
    "npm-run-all": "4.1.5",
    "prettier": "^2.0.5",
    "react-scripts": "3.4.1",
    "source-map-explorer": "^2.4.2",
    "stylelint": "^13.5.0",
    "stylelint-config-standard": "^20.0.0",
    "stylelint-processor-styled-components": "^1.5.0"
  },
  "dependencies": {
    "@types/history": "^4.7.6",
    "@types/lodash": "^4.14.153",
    "@types/react": "^16.9.35",
    "@types/react-datepicker": "^2.11.0",
    "@types/react-dom": "^16.9.8",
    "@types/vfile-message": "^2.0.0",
    "array-move": "^2.2.2",
    "axios": "^0.19.2",
    "axios-cancel": "^0.2.2",
    "bootstrap-daterangepicker": "^3.0.3",
    "classnames": "^2.2.5",
    "file-saver": "^2.0.2",
    "font-awesome": "^4.7.0",
    "history": "^4.7.2",
    "jsoneditor": "^9.0.0",
    "jsoneditor-react": "^3.0.0",
    "lodash": "^4.17.4",
    "lory.js": "^2.5.1",
    "magic-check": "^1.0.3",
    "mobx": "5.15.4",
    "mobx-react": "6.2.2",
    "mobx-react-router": "^4.0.1",
    "mobx-state-tree": "^3.5.0",
    "moment": "^2.19.2",
    "node-sass": "^4.14.1",
    "numeral": "^2.0.6",
    "promise-polyfill": "^8.0.0",
    "prop-types": "^15.6.2",
    "react": "16.13.1",
    "react-avatar-cropper": "^0.1.3",
    "react-bootstrap": "1.0.1",
    "react-bootstrap-daterangepicker": "^4.1.0",
    "react-bootstrap-table": "^4.0.6",
    "react-color": "^2.13.8",
    "react-datepicker": "2.16.0",
    "react-dom": "16.13.1",
    "react-highlight": "^0.12.0",
    "react-moment": "^0.9.7",
    "react-router": "^5.2.0",
    "react-router-dom": "5.2.0",
    "react-select": "^3.1.0",
    "select2": "^4.0.6-rc.1",
    "set-interval": "^2.0.3",
    "styled-components": "5.1.1",
    "sweetalert2-react": "^0.8.3",
    "url-loader": "^4.1.0",
    "validatorjs": "^3.13.3",
    "zingchart": "2.9.0",
    "zingchart-react": "1.0.6"
  },
  "scripts": {
    "analyze": "source-map-explorer build/static/js/main.*",
    "lint:css": "stylelint --fix './components/**/*.js'",
    "lint:js": "eslint ./src --ext=js --ext=jsx --fix",
    "lint": "npm-run-all lint:js lint:css",
    "flow": "flow",
    "precommit": "yarn lint",
    "start-js": "react-scripts start",
    "start": "npm-run-all -p watch-css start-js",
    "build": "yarn build-css && CI=false REACT_APP_VERSION=$(git rev-parse --abbrev-ref HEAD)-$(git rev-parse --short HEAD) react-scripts build",
    "build:prod": "PUBLIC_URL=$HOME_PAGE yarn build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/",
    "watch-css": "yarn build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
    "deploy:test": "rm -rf ./build && yarn build && ./scripts/deploy-test.sh",
    "deploy:int": "rm -rf ./build && yarn build && ./scripts/deploy-int.sh",
    "deploy:prod": "rm -rf ./build && yarn build:prod && ./scripts/deploy-prod.sh"
  },
  "husky": {
    "hooks": {
      "pre-commit": "yarn lint"
    }
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
`

please, help to solve this issue

damntrecky commented 4 years ago

You can for sure upgrade to version 2.1.1 and it should work. The zingchart object is not exported in that version. Working out the details why the zingchart export works in npm run start but not npm run build in default react-cli repos.

RomanKontsevoi commented 4 years ago

@damntrecky, thanks a lot for suck a quick response! Problem solved.