React-toolbox: How to setup minimal app using react-toolbox

Created on 4 Nov 2015  路  3Comments  路  Source: react-toolbox/react-toolbox

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?

Contribution Needed

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

All 3 comments

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 ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

landabaso picture landabaso  路  4Comments

fraenku picture fraenku  路  3Comments

saintc0d3r picture saintc0d3r  路  4Comments

Klathmon picture Klathmon  路  3Comments

kodermax picture kodermax  路  4Comments