Monday 5 June 2017

ERROR in ./src/components/BasicList.js Module build failed: SyntaxError: Decorators are not officially supported

I am getting

ERROR in ./src/components/BasicList.js
Module build failed: SyntaxError: Decorators are not officially supported yet in 6.x pending a proposal update.
However, if you need to use them you can install the legacy decorators transform with:

npm install babel-plugin-transform-decorators-legacy --save-dev

and add the following line to your .babelrc file:

{
  "plugins": ["transform-decorators-legacy"]
}

because of

import React from 'react';
// http://glortho.github.io/react-keydown/example/index.html
import keydown from 'react-keydown';

import {Grid, Row, Column} from 'react-cellblock';

import MyComponent from '../utils/MyComponent';

@keydown
export default class BasicList extends MyComponent {

I have installed the package as asked multiple times and still confused as to why it won't work.

.babelrc:

{
  "presets": ["react", "es2015", "stage-1"],
  "plugins": ["transform-decorators-legacy"]

}

packages:

"devDependencies": {
    "babel-core": "^6.2.1",
    "babel-loader": "^6.2.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-es2015": "^6.1.18",
    "babel-preset-react": "^6.1.18",
    "chai": "^3.5.0",
    "chai-jquery": "^2.0.0",
    "jquery": "^2.2.1",
    "jsdom": "^8.1.0",
    "json-loader": "^0.5.4",
    "mocha": "^2.4.5",
    "react-addons-test-utils": "^0.14.7",
    "webpack": "^1.12.9",
    "webpack-dev-server": "^1.14.0"
  },
  "dependencies": {
    "babel-preset-stage-1": "^6.1.18",
    "lodash": "^3.10.1",
    "react": "^0.14.3",
    "react-cellblock": "^3.0.0",
    "react-dom": "^0.14.3",
    "react-keydown": "^1.7.3",
    "react-redux": "4.3.0",
    "react-router": "^2.8.1",
    "react-select": "^1.0.0-rc.5",
    "redux": "^3.0.4",
    "requests": "^0.1.7",
    "underscore": "^1.8.3"
  }
}

All the answers about this say to do what I already did. I keep restarting npm server to no avail. Any help appreciated, ty



via codyc4321

No comments:

Post a Comment