2016-09-11 46 views
-1

我在从material-ui获取UI的工作中遇到了一些问题。 我一直在寻找互联网和stackoverflow几天来解决我的问题,但我尝试失败的一切。谁能帮我得到这个工作,因为我觉得官方指导不足新秀材质用户界面和反应

在此先感谢

编辑: 对不起,缺乏代码。我意识到我必须运行npm start才能在当地工作。然而这转移了另一个问题。我如何将其部署到我的网络服务器?服务器正在public_html文件夹中查找索引文件。由于这依赖于webpack或gulp我没有看到我应该如何部署到我的服务器?我必须运行node.js还是? 请询问任何后续问题

的WebPack-production.config.js:

const webpack = require('webpack'); 
const path = require('path'); 
const buildPath = path.resolve(__dirname, 'build'); 
const nodeModulesPath = path.resolve(__dirname, 'node_modules'); 
const TransferWebpackPlugin = require('transfer-webpack-plugin'); 

const config = { 
    entry: [path.join(__dirname, '/src/app/app.js')], 
    // Render source-map file for final build 
    devtool: 'source-map', 
    // output config 
    output: { 
    path: buildPath, // Path of output file 
    filename: 'app.js', // Name of output file 
    }, 
    plugins: [ 
    // Define production build to allow React to strip out unnecessary checks 
    new webpack.DefinePlugin({ 
     'process.env':{ 
     'NODE_ENV': JSON.stringify('production') 
     } 
    }), 
    // Minify the bundle 
    new webpack.optimize.UglifyJsPlugin({ 
     compress: { 
     // suppresses warnings, usually from module minification 
     warnings: false, 
     }, 
    }), 
    // Allows error warnings but does not stop compiling. 
    new webpack.NoErrorsPlugin(), 
    // Transfer Files 
    new TransferWebpackPlugin([ 
     {from: 'www'}, 
    ], path.resolve(__dirname, 'src')), 
    ], 
    module: { 
    loaders: [ 
     { 
     test: /\.js$/, // All .js files 
     loaders: ['babel-loader'], // react-hot is like browser sync and babel loads jsx and es6-7 
     exclude: [nodeModulesPath], 
     }, 
    ], 
    }, 
}; 

module.exports = config; 
+0

您寻求帮助,但您不解释您的问题...... – olibiaz

+0

问题是什么,先生?与我们分享您想要发生的事情以及造成错误的代码。 –

+0

感谢您的回复。我更新了我的问题 – frisk0

回答

1

什么是你的应用程序入口点?我希望这是index.html,main.html或类似的东西。

发布你的webpack config,package.json或者你用来运行webpack的文件。

取决于它的构建方式,有多种方式可以运行prod ready build。如果您从某处复制它,它可能具有构建脚本。例如,npm run build

我期望它会创建一个名为public或类似的文件夹,index.htmlbundle.js JavaScript文件。

那你可以加载到你的网络服务器。

在我看来,这是一个很好的例子。 http://reactboilerplate.com/

+0

Hi Kimmo。我有一个'webpack-production.config.js'文件,我在问题中发布了这个文件 – frisk0