yahoo / fluxible

A pluggable container for universal flux applications.
http://fluxible.io
Other
1.81k stars 228 forks source link

yo generator won't build a 3rd party jsx component but will build with regular webpack #48

Closed timothyjlaurent closed 9 years ago

timothyjlaurent commented 9 years ago

I have been trying to get react-autcomplete installed in a yo fluxible project.

React-autocomplete is uses the .js extension so I changed the loader to

 40                 },
 41                 module: {
 42                     loaders: [
 43                         { test: /\.css$/, loader: 'style!css' },
 44                         { test: /\.jsx?$/, loader: 'jsx-loader' },
 45                         { test: /\.json$/, loader: 'json-loader'}
 46                     ]
 47                 },

Whenever I do this I get

[nodemon] starting `node ./server.js`
 70% 20/20 build modules
/Users/tlaurent/dev/test/node_modules/react-autocomplete/lib/combobox.js:358
      <div className={this.getClassName()}>
      ^
SyntaxError: Unexpected token <
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/tlaurent/dev/test/node_modules/react-autocomplete/lib/main.js:2:13)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
[nodemon] app crashed - waiting for file changes before starting...
timothyjlaurent commented 9 years ago

here is my webpack.config.js that builds correctly when running webpack:

  1 module.exports= {
  2
  3                 resolve: {
  4                     extensions: ['', '.js', '.jsx'],
  5                     alias : {
  6                         "kendo": "kendo-ui-webpack"
  7                     }
  8                 },
  9                 entry: './client.js',
 10                 output: {
 11                     path: './build/js',
 12                     publicPath: '/public/js/',
 13                     filename: '[name].js'
 14                 },
 15                 module: {
 16                     loaders: [
 17                         { test: /\.css$/, loader: 'style!css' },
 18                         { test: /react\-autocomplete/, loader: 'jsx-loader' },
 19                         { test: /\.jsx?/, loader: 'jsx-loader' },
 20                         { test: /\.json$/, loader: 'json-loader'},
 21                         { test: /kendo\-ui\-core[\///].*\.js$/, loader: "imports?jQuery=jquery" }
 22                     ]
 23                 },
 24                 stats: {
 25                     colors: true
 26                 },
 27                 devtool: 'source-map',
 28                 watch: true,
 29                 keepalive: true
 30
 31         }
 32
redonkulus commented 9 years ago

Looks like a duplicate of https://github.com/yahoo/generator-fluxible/issues/6#issuecomment-75348123, closing this.