Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 import compliation #12

Open
aagrav opened this issue Oct 12, 2015 · 6 comments
Open

ES6 import compliation #12

aagrav opened this issue Oct 12, 2015 · 6 comments
Assignees

Comments

@aagrav
Copy link

aagrav commented Oct 12, 2015

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

@eTorAken
Copy link
Collaborator

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.

@aagrav
Copy link
Author

aagrav commented Oct 13, 2015

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

@eTorAken
Copy link
Collaborator

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) 😉

@micimize
Copy link

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

@vedmant
Copy link

vedmant commented Jan 29, 2016

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

@bobbykolev
Copy link

Same here (with babelify)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants