Hi, I'm struggling with preparing env (webpack, ...) to make react-toolbox work with minimal app.
I've cloned React Hot Webpack Boilerplate repo.
Installed react-toolbox via npm.
Added resolve into webpack.config.js.
var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./src/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
resolve: {
extensions: ['', '.jsx', '.scss', '.js', '.json', '.md'],
alias: {
'react-toolbox': path.resolve(__dirname, './node_modules/react-toolbox/components')
},
modulesDirectories: [
'node_modules',
path.resolve(__dirname, './node_modules'),
path.resolve(__dirname, './../node_modules'),
path.resolve(__dirname, './../components')
]
},
module: {
loaders: [{
test: /(\.js|\.jsx)$/,
loaders: ['babel'],
include: path.join(__dirname, 'src')
}]
}
};
My App.js
import React, { Component } from 'react';
import Button from 'react-toolbox/button';
export default class App extends Component {
render() {
return (
<h1>Hello, world.</h1>
<Button label="Hello world" kind="raised" accent />
);
}
}
But webpack dev server is reporting error:
ERROR in ./~/react-toolbox/components/button/index.jsx
Module parse failed: /Users/finch/dev/react-toolbox-sample/node_modules/react-toolbox/components/button/index.jsx Line 1: Unexpected token
You may need an appropriate loader to handle this file type.
| import React from 'react';
| import FontIcon from '../font_icon';
| import Ripple from '../ripple';
@ ./src/App.js 13:14-45
webpack: bundle is now VALID.
What I'm missing here?
Hi @mauron85 , I appreaciate your interest in react-toolbox ... 2 days ago I created a repo with a complete example https://github.com/react-toolbox/react-toolbox-example
@soyjavi Thank you. It is exactly what I was looking for.
You're welcome ;)
Most helpful comment
Hi @mauron85 , I appreaciate your interest in react-toolbox ... 2 days ago I created a repo with a complete example https://github.com/react-toolbox/react-toolbox-example