You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to put this strategy to work with the facebook boilerplate create-react-app.
Unfortunally no sucess yet.
The problem I think should be simple but I created a detailed issue to describe the problem.
I tried the following:
create-react-app cssx-example
cd cssx-example
npm run eject
yarn add -D cssx-loader yarn add react-cssx
Edited the file src/App.js from:
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}
export default App;
to:
import React, { Component } from 'react';
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: {{ color }};
}
h1 i {
text-decoration: underline;
}
</style>
);
}
}
export default App;
Edited the file config/webpack.dev.config.js from:
...
// Process JS with Babel.
{
test: /\.(js|jsx)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
},
...
to:
...
// Process JS with Babel.
{
test: /\.(js|jsx)$/,
include: paths.appSrc,
loaders: ['cssx-loader', require.resolve('babel-loader')]
},
...
I'm trying to put this strategy to work with the facebook boilerplate create-react-app.
Unfortunally no sucess yet.
The problem I think should be simple but I created a detailed issue to describe the problem.
I tried the following:
create-react-app cssx-example
cd cssx-example
npm run eject
yarn add -D cssx-loader
yarn add react-cssx
Edited the file
src/App.js
from:to:
Edited the file
config/webpack.dev.config.js
from:to:
Then
npm start
But I got the following error:
I tried some variations like:
loaders: [require.resolve('babel-loader'), 'cssx-loader']
and
for example.
The strange thing is if I put the cssx-loader first it works for a very tiny time, then I get a compiler error.
My issue is very similar to this one.
So, how can we fix this and put CSSX to work with the create-react-app?
I'm very interested to use this approach on my project so a help would be very appreciated.
Thanks in advance.
The text was updated successfully, but these errors were encountered: