AsaAyers / js-hyperclick

A hyperclick provider that lets you jump to where variables are defined.
MIT License
127 stars 42 forks source link

Not working with babel 7 #113

Closed salujaharkirat closed 5 years ago

salujaharkirat commented 5 years ago

I have 2 projects currently opened in my atom editor. One is in babel 6 and another one is in babel 7.

js-hyperlink seems to work fine in the babel-6 project. However, with the babel 7 project the cmd + click does not work at all.

Here is my package.json for the project with babel-7 configuration:-

{
  "name": "babel-7",
  "version": "1.0.0",
  "description": "test",
  "private": true,
  "scripts": {
    "test": "jest",
    "start": "NODE_ENV=localhost webpack-dev-server --config webpack.local.config.js",
    "build:dev": "rimraf ./build/dev && NODE_ENV=development webpack --config webpack.dev.config.js --color --progress ",
    "start:dev": "webpack-dev-server --config webpack.dev.config.js --content-base build/dev --port 9000 --history-api-fallback",
    "build:prod": "rimraf ./build/prod && NODE_ENV=production webpack --config webpack.prod.config.js --color --progress ",
    "start:prod": "webpack-dev-server --config webpack.prod.config.js --content-base build/prod --port 9000 --history-api-fallback",
    "deploy:dev": "sh scripts/deploy-dev.sh",
    "deploy:prod": "sh scripts/deploy-prod.sh"
  },
  "repository": {
    "type": "git",
    "url": ""
  },
  "author": "",
  "license": "ISC",
  "homepage": "https://bitbucket.org/lygometry/agent-frontend#readme",
  "devDependencies": {
    "@babel/core": "^7.4.4",
    "@babel/plugin-proposal-class-properties": "^7.4.4",
    "@babel/plugin-syntax-dynamic-import": "^7.2.0",
    "@babel/plugin-transform-modules-commonjs": "^7.4.4",
    "@babel/preset-env": "^7.4.4",
    "@babel/preset-react": "^7.0.0",
    "babel-eslint": "^10.0.1",
    "babel-jest": "^24.8.0",
    "babel-loader": "^8.0.5",
    "css-loader": "^2.1.1",
    "enzyme": "^3.9.0",
    "enzyme-adapter-react-16": "^1.12.1",
    "eslint": "^5.16.0",
    "eslint-config-eslint": "^5.0.1",
    "eslint-friendly-formatter": "^4.0.1",
    "eslint-loader": "^2.1.2",
    "eslint-plugin-import": "^2.17.2",
    "eslint-plugin-jsx-a11y": "^6.2.1",
    "eslint-plugin-node": "^9.0.1",
    "eslint-plugin-react": "^7.13.0",
    "file-loader": "^3.0.1",
    "html-webpack-plugin": "^3.2.0",
    "jest": "^24.8.0",
    "react-test-renderer": "^16.8.6",
    "redux-logger": "^3.0.6",
    "rimraf": "^2.6.3",
    "sass-loader": "^7.1.0",
    "style-loader": "^0.23.1",
    "uglifyjs-webpack-plugin": "^2.1.2",
    "url-loader": "^1.1.2",
    "webpack": "^4.30.0",
    "webpack-cli": "^3.3.2",
    "webpack-dev-server": "^3.3.1"
  },
  "dependencies": {
    "@babel/polyfill": "^7.4.4",
    "apollo-cache-inmemory": "^1.5.1",
    "apollo-client": "^2.5.1",
    "apollo-link-context": "^1.0.17",
    "apollo-link-http": "^1.5.14",
    "axios": "^0.18.0",
    "classnames": "^2.2.6",
    "deploy-aws-s3-cloudfront": "^1.0.0",
    "graphql": "^14.2.1",
    "graphql-tag": "^2.10.1",
    "humps": "^2.0.1",
    "js-cookie": "^2.2.0",
    "node-sass": "^4.12.0",
    "rc-drawer": "^0.4.11",
    "react": "^16.8.6",
    "react-apollo": "^2.5.5",
    "react-custom-scrollbars": "^4.2.1",
    "react-dom": "^16.8.6",
    "react-hot-loader": "^4.8.4",
    "react-intl": "^2.9.0",
    "react-recaptcha-v3": "^1.1.0",
    "react-redux": "^7.0.3",
    "react-router": "^5.0.0",
    "react-router-dom": "^5.0.0",
    "react-table": "6.8.0",
    "react-typed": "^1.1.2",
    "reactstrap": "^8.0.0",
    "recharts": "^1.6.0",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0"
  },
  "moduleRoots": [
    "./src"
  ]
}

babel.config.js

module.exports = {
  presets: ["@babel/preset-env", "@babel/preset-react"],
  plugins: ["@babel/plugin-proposal-class-properties"]
};

Here is my project with babel 6 configuration (which works) :-

{
  "name": "babel-6",
  "version": "0.0.1",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "NODE_ENV=localhost webpack-dev-server --config webpack.local.config.js",
    "build:dev": "rimraf ./build/dev && NODE_ENV=development webpack --config webpack.dev.config.js --color --progress ",
    "start:dev": "webpack-dev-server --config webpack.dev.config.js --content-base build/dev --port 9000 --history-api-fallback",
    "build:prod": "rimraf ./build/prod && NODE_ENV=production webpack --config webpack.prod.config.js --color --progress ",
    "start:prod": "webpack-dev-server --config webpack.prod.config.js --content-base build/prod --port 9000 --history-api-fallback",
    "styleguide": "styleguidist server",
    "docs": "styleguidist build && npx jsdoc -c jsdoc.conf.json",
    "build": "npm run build:dev && npm run build:prod",
    "lint": "eslint src",
    "lint:fix": "eslint src --fix"
  },
  "repository": "",
  "author": "",
  "contributors": [],
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-eslint": "^10.0.1",
    "babel-loader": "^7.1.2",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.5",
    "babel-polyfill": "^6.23.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-es2015": "^6.22.0",
    "babel-preset-react": "^6.22.0",
    "babel-preset-stage-0": "^6.24.1",
    "create-index": "^2.3.0",
    "crypto-js": "^3.1.9-1",
    "css-loader": "^0.28.4",
    "esdoc": "^1.1.0",
    "esdoc-standard-plugin": "^1.0.0",
    "eslint": "^5.7.0",
    "eslint-config-eslint": "^5.0.1",
    "eslint-friendly-formatter": "^4.0.1",
    "eslint-loader": "^2.1.1",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.1.2",
    "eslint-plugin-node": "^7.0.1",
    "eslint-plugin-react": "^7.11.1",
    "file-loader": "^1.1.6",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^2.30.1",
    "image-webpack-loader": "^4.3.1",
    "jsdoc": "^3.5.5",
    "react-styleguidist": "^6.2.4",
    "rimraf": "^2.5.4",
    "standard": "^10.0.3",
    "style-loader": "^0.20.1",
    "webpack": "^3.11.0",
    "webpack-bundle-analyzer": "^2.9.1",
    "webpack-dev-server": "^2.2.1",
    "workbox-webpack-plugin": "^3.4.1"
  },
  "dependencies": {
    "axios": "^0.16.2",
    "check-types": "^7.3.0",
    "crypto-js": "^3.1.9-1",
    "frontend-models": "bitbucket:wealthy/frontend-models#v1.0.22",
    "graphql": "^0.13.2",
    "graphql-tag": "^2.7.3",
    "highcharts": "^6.0.6",
    "history": "^4.6.3",
    "humps": "^2.0.1",
    "js-cookie": "^2.1.4",
    "md5": "^2.2.1",
    "moment": "^2.22.2",
    "prop-types": "^15.5.10",
    "rc-dialog": "^7.1.3",
    "rc-select": "^7.7.1",
    "rc-slider": "^8.3.1",
    "react": "^16.6.3",
    "react-apollo": "^1.4.15",
    "react-cookie": "^2.0.7",
    "react-dom": "^16.3.0",
    "react-dropzone": "^4.2.7",
    "react-helmet": "^5.2.0",
    "react-highcharts": "^16.0.2",
    "react-hot-loader": "^3.0.0-beta.7",
    "react-joyride": "^2.0.0-11",
    "react-loadable": "^5.3.1",
    "react-page-visibility": "^1.0.0",
    "react-redux": "^5.0.5",
    "react-router": "^4.1.1",
    "react-router-dom": "^4.1.1",
    "react-scroll-to-component": "^1.0.2",
    "react-switch": "^2.3.0",
    "react-tippy": "^1.2.2",
    "react-toastify": "^3.3.2",
    "react-transition-group": "^2.2.0",
    "react-webcam": "^0.5.0",
    "redux": "^3.6.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.2.0",
    "sanitize.css": "5.0.0",
    "sockette": "^2.0.0",
    "styled-components": "^3.1.6",
    "uuid": "^3.0.1",
    "wealthy-ui-utils": "bitbucket:wealthy/wealthy-ui-utils"
  },
  "moduleRoots": [
    "./src",
    "./src/components"
  ]
}

.babelrc

{
  "presets": [
    "es2015",
    "react",
    "stage-0"
  ],
  "plugins": [
    ["transform-class-properties", { "spec": true }],
    "react-hot-loader/babel",
    "transform-decorators-legacy"
  ]
}

Can someone please help? TIA