rails/webpacker

regeneratorRuntime is not defined

bondanherumurti opened this issue · 6 comments

i tried to use the async function to integrate with react-relay and it seems it does not support the function

screen shot 2017-06-19 at 3 24 26 pm

anyone experience this, and i tried several steps including installing babel-polyfill but it still not working, any idea?

@bondanherumurti What version of node and webpacker are you using?

node -> v7.8.0
webpacker gem v2.0.0

my package.json info:

{
  "dependencies": {
    "babel-core": "^6.24.1",
    "babel-loader": "7.x",
    "babel-plugin-syntax-dynamic-import": "^6.18.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-polyfill": "^6.23.0",
    "babel-preset-env": "^1.5.1",
    "babel-preset-react": "^6.24.1",
    "coffee-loader": "^0.7.3",
    "coffee-script": "^1.12.6",
    "compression-webpack-plugin": "^0.4.0",
    "css-loader": "^0.28.3",
    "extract-text-webpack-plugin": "^2.1.0",
    "file-loader": "^0.11.1",
    "glob": "^7.1.2",
    "js-yaml": "^3.8.4",
    "lodash": "^4.17.4",
    "node-sass": "^4.5.3",
    "path-complete-extname": "^0.1.0",
    "postcss-cssnext": "^2.11.0",
    "postcss-loader": "^2.0.5",
    "postcss-smart-import": "^0.7.2",
    "prop-types": "^15.5.10",
    "rails-erb-loader": "^5.0.1",
    "react": "^15.5.4",
    "react-checkbox-group": "^3.1.1",
    "react-dom": "^15.5.4",
    "react-redux": "^5.0.5",
    "react-relay": "^1.0.0",
    "react-router-dom": "next",
    "react_ujs": "^2.2.0",
    "redux": "^3.6.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.2.0",
    "resolve-url-loader": "^2.0.2",
    "sass-loader": "^6.0.5",
    "style-loader": "^0.18.1",
    "webpack": "^2.6.1",
    "webpack-manifest-plugin": "^1.1.0",
    "webpack-merge": "^4.1.0"
  },
  "devDependencies": {
    "babel-core": "^6.25.0",
    "babel-loader": "^7.0.0",
    "babel-plugin-relay": "^1.0.1",
    "relay-compiler": "^1.0.0",
    "webpack-dev-server": "^2.4.5"
  },
  "scripts": {
    "relay": "relay-compiler --src ./app/javascript/components/ --schema ./app/graphql/schema.graphql"
  }
}

@bondanherumurti Try this in .babelrc and remove babel-polyfill since that's natively supported in the version of node you are using.

"targets": {
   "node": "current"
 }
{
  "presets": [
    [
      "env",
      {
        "modules": false,
        "targets": {
          "node": "current",
          "browsers": "> 1%",
          "uglify": true
        },
        "useBuiltIns": true
      }
    ],
    "react"
  ],
  "plugins": [
    "syntax-dynamic-import",
    [
      "transform-class-properties",
      {
        "spec": true
      }
    ],
    "relay"
  ]
}

tried this on my .babelrc still not working

Try this please

{
  "presets": [
    [
      "env",
      {
        "modules": false,
        "targets": {
          "node": "current"
        }
      }
    ],
    "react"
  ],

  "plugins": [
    "relay",
    "syntax-dynamic-import",
    [
      "transform-class-properties",
      {
        "spec": true
      }
    ]
  ]
}

IT WORKS! Thank you man @gauravtiwari