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

problems working w react + babel #17

Open
geddski opened this issue Jul 29, 2016 · 2 comments
Open

problems working w react + babel #17

geddski opened this issue Jul 29, 2016 · 2 comments

Comments

@geddski
Copy link

geddski commented Jul 29, 2016

I'm trying to get this to compile when using react + babel + webpack. I ran the create-react-app starter tool, then npm run eject so I could modify the config.

Then changing my webpack config like so:

loaders: [
   {
        test: /\.js$/,
        include: paths.appSrc,
        loaders: [
          'babel?' + JSON.stringify(require('./babel.dev')),
          'cssx-loader'
        ]
  }
]

But the compiler fails:
image

Any ideas I could try?

@geddski
Copy link
Author

geddski commented Jul 29, 2016

React component code if it helps:

import React, { Component } from 'react';
import logo from './logo.svg';
import CSSX from 'react-cssx';

class App extends Component {
  render() {
    return (
      <CSSX styles={ this.css() }>
        <h1>Title styled with <i>CSSX</i></h1>
      </CSSX>
    );
  }

  css() {
    // var color = '#BADA55';

    return (
      <style>
        h1 {
          color: blue;
        }
      </style>
    );
  }

}

export default App;

@krasimir
Copy link
Owner

krasimir commented Jul 30, 2016

@geddski can we try placing the cssx-loader first. Babel should run after it.

loaders: [
   {
        test: /\.js$/,
        include: paths.appSrc,
        loaders: [
          'cssx-loader',
          'babel?' + JSON.stringify(require('./babel.dev')),
        ]
  }
]

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

2 participants