我從react-toolbox網站複製了基本的按鈕實現,它似乎在react-toolbox主題中出現錯誤。請查看錯誤截圖。React-Toolbox主題錯誤
我index.js文件
import React from 'react';
import ReactDOM from 'react-dom';
import { Button } from 'react-toolbox/lib/button';
ReactDOM.render(
<Button label="Hello World!" />,
document.getElementById('app')
);
我webpack.config.js文件
var HTMLWebpackPlugin = require('html-webpack-plugin');
var HTMLWebpackPluginConfig = new HTMLWebpackPlugin({
\t template: __dirname + '/app/index.html', \t
\t filename: 'index.html',
\t inject: 'body'
});
module.exports = {
\t entry: __dirname + '/app/index.js',
\t module: {
\t \t loaders: [
\t \t \t {
\t \t \t \t test: /\.js$/,
\t \t \t \t exclude: /node_modules/,
\t \t \t \t loader: 'babel-loader'
\t \t \t }
\t \t ]
\t },
\t output: {
\t \t filename: 'transformed.js',
\t \t path: __dirname+'/build'
\t },
\t plugins: [HTMLWebpackPluginConfig]
};
和的package.json文件
{
"name": "react2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack",
"start": "webpack-dev-server"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-toolbox": "^2.0.0-beta.7"
},
"devDependencies": {
"babel-core": "^6.23.1",
"babel-loader": "^6.3.2",
"babel-preset-react": "^6.23.0",
"html-webpack-plugin": "^2.28.0",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1"
}
}
我這麼想嗎?因爲所有的網站說是npm install --save react-toolbox
,沒有更多。
注 - npm build
運行良好。 npm start
給出錯誤。
請指導:)