gulp-render icon indicating copy to clipboard operation
gulp-render copied to clipboard

Unexpected Token '>'

Open buxel opened this issue 11 years ago • 7 comments

Hi, I'am currently using your react-starter-kit and trying to use material-ui with it. When i require it in a component, i get the following exception:

/home/ubuntu/workspace/windowManager/node_modules/material-ui/docs/dist/js/app-bar.jsx:29
    if (this.props.title) title = <h1 className="mui-app-bar-title">{this.prop
                                  ^
{ [SyntaxError: Unexpected token <]
  name: 'SyntaxError',
  message: 'Unexpected token <',
  stack: 'SyntaxError: Unexpected token <\n    at Module._compile (module.js:439:25)\n    at Module._extensions..js (module.js:474:10)\n    at Object.Plugin.reactTransform (/home/ubuntu/workspace/windowManager/node_modules/gulp-render/index.js:68:7)\n    at Module.load (module.js:356:32)\n    at Function.Module._load (module.js:312:12)\n    at Module.require (module.js:364:17)\n    at require (module.js:380:17)\n    at Object.<anonymous> (/home/ubuntu/workspace/windowManager/node_modules/material-ui/docs/dist/index.js:2:10)\n    at Module._compile (module.js:456:26)\n    at Module._extensions..js (module.js:474:10)',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-render' }

I checked the file and found nothing wrong with it, that's why this issue is reported here and not over at meteor-ui.

Any advice?

buxel avatar Nov 04 '14 13:11 buxel

Can you add a test case here, how to reproduce the back?

https://github.com/koistya/gulp-render/blob/master/test.js

koistya avatar Nov 04 '14 13:11 koistya

I'll give it a shot tonight. Could you explain what you did with

var render = require('./');
...
var stream = render();

I get that you want to create the component on the fly but how does this also transform .jsx ?

buxel avatar Nov 04 '14 14:11 buxel

require('./') is the same as require('./index.js') which is gulp-render plug-in.

var stream = render(); initializes the plugin.

Here it's adding JSX Harmony transform instead of default one (for all the files with .js and .jsx extensions): https://github.com/koistya/gulp-render/blob/master/index.js#L72-L73

koistya avatar Nov 04 '14 17:11 koistya

@koistya, I tried to reproduce the error but something is still missing. It might be a mixin that is used, not sure how to verify that without adding the whole mixin to the test. You can take a look at it here: https://ide.c9.io/chaosd/gulp-render Or my forked repo here: https://github.com/ChaosD/gulp-render

buxel avatar Nov 05 '14 06:11 buxel

@koistya , i updated c9 and my branch to include material-ui in the test so you might have a look at whats wrong.

buxel avatar Nov 06 '14 06:11 buxel

@ChaosD cool, thanks! I will try to debug it.

koistya avatar Nov 06 '14 06:11 koistya

@koistya , no problem, tell me when i can close the c9 workspace.

buxel avatar Nov 07 '14 06:11 buxel