react-animate icon indicating copy to clipboard operation
react-animate copied to clipboard

ES6 import compliation

Open aagrav opened this issue 9 years ago • 6 comments

Errors compiling index.jsx due to syntax errors. Newbie so I've tried changing lint files to no avail

aagrav avatar Oct 12 '15 19:10 aagrav

Could you please give us the stack trace you got while compiling? We cannot help you if we do not know where this happens.

Thanks.

eTorAken avatar Oct 13 '15 13:10 eTorAken

SyntaxError: Unexpected token (28:6) while parsing xxxx
node_modules\react-animate\src\index.jsx

here's my browserfy package.json

{
  "name": "Collections",
  "version": "1.0.0",
  "description": "Collections System for CSAB",
  "repository": "None",
  "main": "js/App.js",
  "dependencies": {
    "flux": "~2.1.0",
    "mixin": "*",
    "react": "~0.13.3",
    "react-bootstrap": "~0.23.7",
    "react-bootstrap-table": "*",
    "react-router": "^0.13.3",
    "react-select": "*",
    "react-tools": "~0.13.3",
    "babel-jest": "*",
    "jest-cli": "*",
    "react-router-bootstrap": "~0.18",
    "underscore": "~1.8.3"
  },
  "devDependencies": {
    "babelify": "~6.1.3",
    "browserify": "~4.2.2",
    "envify": "~2.0.1",
    "reactify": "~1.1.1",
    "uglify-js": "~2.4.15",
    "watchify": "~3.3.0"
  },
  "scripts": {
    "start": "watchify -o public/js/collections.js -t babelify -v -d src/App.js",
    "build": "NODE_ENV=production browserify | uglifyjs -cm > dist/collections.min.js",
    "test": "jest"
  },
  "browserify": {
    "transform": [
      "babelify",
      "envify"
    ]
  },
  "jest": {
    "scriptPreprocessor": "babel-jest",
    "unmockedModulePathPatterns": ["react"]
  },
  "author": "Aylwin Agraviador",
  "license": "Apache-2.0"
}

used npm install react-animate

aagrav avatar Oct 13 '15 18:10 aagrav

I do not know babelify, did you try it with babel itself?

Your error is weird as it triggers a unexpected token on the line:

if(!userAgent) {

which is not en ES6/7 code.

BTW, try to add some markdown to your post. It improves its readability (I've done it for your previous post) :wink:

eTorAken avatar Oct 14 '15 09:10 eTorAken

I got a similar compilation issue after upgrading to 3.0.0, because the module requires babel compilation, but node_modules are excluded by default:

[piping] error given was: /Path/to/project/node_modules/react-animate/src/index.jsx:1
[1] (function (exports, require, module, __filename, __dirname) { import raf from
[1]                                                               ^^^^^^
[1] SyntaxError: Unexpected reserved word
[1]     at exports.runInThisContext (vm.js:73:16)
[1]     at Module._compile (module.js:443:25) ....

I'm using webpack, haven't resolved it yet but I imagine it's the same as in the S/O issue

micimize avatar Oct 25 '15 16:10 micimize

I have problems too, getting this error: Unexpected token (2:7) while parsing react-animate/src/index.jsx, I have all presents in babel.

vedmant avatar Jan 29 '16 04:01 vedmant

Same here (with babelify)

bobbykolev avatar Mar 30 '16 08:03 bobbykolev