node-jsx icon indicating copy to clipboard operation
node-jsx copied to clipboard

Parse Error: Illegal return statement

Open raine opened this issue 10 years ago • 3 comments

Added require('node-jsx').install() to my app and getting Illegal return statement when it tries to parse node libs under node_modules/.

I'm guessing { extension: '.jsx' } fixes it but I don't think this should happen.

What's up?

Error: Error transforming /project/node_modules/express/node_modules/methods/index.js to JSX: Error: Parse Error: Line 9: Illegal return statement

express/node_modules/methods/index.js

var http = require('http');

if (http.METHODS) {
  module.exports = http.METHODS.map(function(method){
    return method.toLowerCase();
  });

  return;
}

raine avatar Aug 16 '14 22:08 raine

Getting the same thing

Error transforming /Users/buie/Sites/fifa-heroes/node_modules/browserify-middleware/node_modules/browserify/node_modules/module-deps/node_modules/parents/node_modules/path-platform/path.js to JSX: Error: Parse Error: Line 29: Illegal return statement`

Is the default behavior to parse any .js file in the project into .jsx? Doesn't seem like an obvious expectation.

ryanblakeley avatar Jan 06 '15 05:01 ryanblakeley

Getting the same with the BrowserSync module:

Error: Error transforming [app]/node_modules/browser-sync/index.js to JSX: Error: Parse Error: Line 1: Unexpected token ILLEGAL

Triggered by this line in that file: #! /usr/bin/env node

Might be nice to be able to exclude certain folders, like node_modules for example.

benoneal avatar Feb 27 '15 05:02 benoneal

+1

codemeasandwich avatar Jul 03 '16 21:07 codemeasandwich