banderson / generator-flux-react

A yeoman generator for app based on Facebook's Flux/React architecture
332 stars 35 forks source link

Add .jsx to browserify extensions ? #45

Open darkyen opened 8 years ago

darkyen commented 8 years ago

Optionally you can use .jsx extension. That will allow using

import AppContainer from './components/AppContainer';

over

import AppContainer from './components/AppContainer.jsx';
banderson commented 8 years ago

My gulp/browserify chops have been getting rusty, and I forget the best place to do this :open_mouth:

How do you normally accomplish this?

darkyen commented 8 years ago

I just keep them in Browserify Options.

darkyen commented 8 years ago

Also since you do not have a .babelrc for babel 6 and other transforms I started following this pattern in config

    settings: {
      transform: [{name: 'babelify', opts: {
        plugins: ['transform-decorators-legacy'],  
        presets: ['es2015', 'react', 'stage-0'],
      }}]
    },

and then in browserify

config.settings.transform.forEach(function(t) {
  bundler.transform(t.name, t.opts);
});

also babel takes care of React now so you don't need reactify, infact npm-install react-tools will tell you its deprecated.