Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

How to run react app on apache server

const webpack = require('webpack');
const path = require('path');
var config = {
    entry: './main.js',

    output: {
        path: path.join(__dirname, '/dist'),
        filename: 'index.js',
    },

    devServer: {
        inline: true,
        port: 8080
    },
    resolveLoader: {
        modules: [path.join(__dirname, 'node_modules')]
    },
    module: {
        loaders: [
            {
                test: /.jsx?$/,
                exclude: /node_modules/,
                loader: 'babel-loader',

                query: {
                    presets: ['es2015', 'react']
                }
            }
        ]
    },
}

module.exports = config;


//Then the package json file
{
  "name": "reactapp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "webpack --progress",
    "production": "webpack -p --progress"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "react": "^15.4.2",
    "react-dom": "^15.4.2",
    "webpack": "^2.2.1"
  },
  "devDependencies": {
    "babel-core": "^6.0.20",
    "babel-loader": "^6.0.1",
    "babel-preset-es2015": "^6.0.15",
    "babel-preset-react": "^6.0.15",
    "babel-preset-stage-0": "^6.0.15",
    "express": "^4.13.3",
    "webpack": "^1.9.6",
    "webpack-devserver": "0.0.6"
  }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: Accessing HTML attributes in DOM 
Javascript :: operadores de asignacion javascript 
Javascript :: vue__WEBPACK_IMPORTED_MODULE_0__.reactive) 
Javascript :: javascript declare variables 
Javascript :: Convert to String Explicitly 
Javascript :: ring add an attribute to the object 
Javascript :: JavaScript Add Methods to a Constructor Function Using Prototype 
Javascript :: javascript Benefit of Using Symbols in Object 
Javascript :: reading an array from python to js 
Javascript :: javascript for...of with Maps 
Javascript :: javascript Assigning to a getter-only property is not allowed 
Javascript :: javascript best practices 
Javascript :: !Object.construct polyfill 
Javascript :: JavaScript / jQuery DOM Selectors 
Javascript :: vite config js load env 
Javascript :: How to Update the Props of a Rendered Component in vue Testing Library 
Javascript :: change origin xy phaser 
Javascript :: phaser place on triangle 
Javascript :: phaser animation on start event 
Javascript :: como usar variables en selector jquery 
Javascript :: object destructuring in javascript 
Javascript :: Call this API in order to fetch the user data. API: https://jsonplaceholder.typicode.com/users. 
Javascript :: mongo db backup node js daily 
Javascript :: postgresql nodejs 
Javascript :: regex capture group example 
Javascript :: sort array method 
Javascript :: hide and show div using javascript with example 
Javascript :: process node.js example 
Javascript :: javascript callback function 
Javascript :: .remove javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =