0

I'm having some problems getting the UI from material-ui to work. I've been searching the internet and stackoverflow for days to resolve my problems but everything i try fails. Can anyone help me getting this to work, since i find the official guide inadequate for rookies

Thanks in advance

Edit: Sorry for the lack of code. I realized that i had to run npm start in order to get this to work locally. However this divert another question. How do i deploy this to my webserver? The server is looking an index file in public_html folder. Since this rely on webpack or gulp i dont see how i'm supposed to deploy this to my server? Do i have to run node.js or? Please ask for any follow up questions

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;
3
  • You asking for help but you don't explain your problem... Commented Sep 12, 2016 at 0:22
  • What is the problem, sir? share us what you want to happen and the code that is posing the error. Commented Sep 12, 2016 at 5:56
  • Thanks for your reply. I updated my question Commented Sep 12, 2016 at 12:53

1 Answer 1

1

What is your application entry point? I would expect that to be index.html, main.html or something similar.

Post your webpack config, package.json or or what ever file you use to run webpack.

Depending how it's build there are multible ways to run prod ready build. It probably has build script if you copied it from somewhere. npm run build for example.

I expect it will create folder called public or something similar and index.html with bundle.js javascript file.

That you can then load to your webserver.

Here is really good example in my opinion. http://reactboilerplate.com/

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Kimmo. I have a webpack-production.config.js file, which i have posted in the question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.