I have a react project with Webpack which I'm trying to dockerize it following this article.
Dockerfile:
FROM node:12.14.1
RUN npm install webpack -g
WORKDIR /tmp
COPY package.json /tmp/
RUN npm config set registry http://registry.npmjs.org/ && npm install
WORKDIR /usr/app
COPY . /usr/app/
RUN cp -a /tmp/node_modules /usr/app/
RUN webpack
ENV NODE_ENV=production
ENV PORT=4000
CMD [ "/usr/local/bin/node", "--experimental-modules", "./src/index.js" ]
EXPOSE 4000
docker-compose.yml:
ex_dashboard:
build: .
ports:
- "80:4000"
volumes:
- .:/usr/app/:rw
environment:
- NODE_ENV=dev
command: >
sh -c '
if test -d node_modules;
then
echo node_modules_exists ;
else
cp -a /tmp/node_modules /usr/app/dashboard;
fi &&
npm install &&
/usr/local/bin/node --experimental-modules ./src/index.js
'
When I run docker-compose up, everything goes well until I encounter this error:
ex_dashboard_1 | (node:18) ExperimentalWarning: The ESM module loader is experimental.
ex_dashboard_1 | file:///usr/app/src/index.js:9
ex_dashboard_1 | <Provider store={store}>
ex_dashboard_1 | ^
ex_dashboard_1 |
ex_dashboard_1 | SyntaxError: Unexpected token '<'
ex_dashboard_1 | at Loader.moduleStrategy (internal/modules/esm/translators.js:66:18)
ex_dashboard_1 | at async link (internal/modules/esm/module_job.js:37:21)
The whole project works well if I just run it by npm start or build it by npm run build. But I don't know why this happens in docker container.
Here is package.json:
{
"name": "explore_dashboard",
"version": "1.0.0",
"description": "A dashboard for the Explore project",
"main": "index.js",
"type": "module",
"scripts": {
"start": "cross-env NODE_ENV=development webpack-dev-server --hot",
"build": "cross-env NODE_ENV=production webpack",
"lint": "eslint ./src",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://gitlab.basalam.dev/data/explore_dashboard.git"
},
"author": "Gh.Sherafati",
"license": "ISC",
"resolve": {
"alias": {
"react-dom": "#hot-loader/react-dom"
}
},
"devDependencies": {
"#babel/core": "^7.8.4",
"#babel/plugin-transform-runtime": "^7.8.3",
"#babel/preset-env": "^7.8.4",
"#babel/preset-react": "^7.8.3",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"cross-env": "^7.0.0",
"css-loader": "^3.4.2",
"eslint": "^6.1.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-loader": "^3.0.3",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.0",
"eslint-plugin-react-hooks": "^1.7.0",
"html-webpack-plugin": "^3.2.0",
"node-sass": "^4.13.1",
"sass-loader": "^8.0.2",
"style-loader": "^1.1.3",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.2"
},
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.27",
"#fortawesome/free-solid-svg-icons": "^5.12.1",
"#fortawesome/react-fontawesome": "^0.1.8",
"#hot-loader/react-dom": "^16.11.0",
"#types/react": "^16.9.19",
"axios": "^0.19.2",
"react": "^16.12.0",
"react-beautiful-dnd": "^12.2.0",
"react-dom": "^16.12.0",
"react-hot-loader": "^4.12.19",
"react-redux": "^7.1.3",
"redux": "^4.0.5",
"redux-saga": "^1.1.3"
}
}
And webpack.config.js:
const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { env } = process;
module.exports = {
entry: './src/index.js',
mode: env.NODE_ENV,
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader', 'eslint-loader'],
},
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
'style-loader',
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader',
],
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx'],
},
output: {
path: path.join(__dirname, '/build'),
publicPath: '/',
filename: 'bundle.js',
},
plugins: [
new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(env.NODE_ENV) }),
new HtmlWebpackPlugin({
template: path.resolve('./src/index.html'),
}),
],
devServer: {
contentBase: './build',
hot: true,
},
devtool: env.NODE_ENV === 'development' ? 'cheap-module-eval-source-map' : undefined,
};
Also index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import store from './redux/store';
import App from './components/App';
import './scss/main.scss';
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('app'),
);
module.hot.accept();
The --experimental-modules flag can be used to enable support for ECMAScript modules (ES modules).
option 1
CMD ["sh", "-c", "exec node --experimental-modules index.js"]
option 2
CMD exec node --experimental-modules index.js
Full Docs:
In your docker-compose.yml file, delete the volumes: and the rather long-winded command:.
The important thing that’s going on here is that your index.js file actually includes JSX constructs that React uses; it’s not plain Javascript and node can’t run it directly. In your Dockerfile you RUN webpack, which transpiles this into plain Javascript. The volumes: overwrite all of this with whatever content is on your local system; that does not include a transpilation step, so you don’t have valid Javascript for Node to run.
(It might work to put an explicit call to webpack in that command:. This assumes your host and container node_modules are compatible, and it is literally duplicating everything the Dockerfile does to build the image in the docker-compose.yml file.)
Nothing stops you from installing Node on your host system (if you don’t already have it), doing live development using the Webpack dev server, and then using Docker for a final packaging step. That’s probably much more convenient than introducing an isolation system like Docker and then trying to work around all of its features to emulate a local development setup.
Finally I've solve the issue by using nginx and running the build version in the container getting help from this great article.
The new Dockerfile and docker-compose.yml follows:
Dockerfile:
FROM node:12.14.1 as build
WORKDIR /app
COPY . /app
ENV PATH /app/node_modules/.bin:$PATH
RUN npm install
RUN npm run build
FROM nginx:alpine
COPY --from=build /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
docker-compose.yml:
version: "3"
services:
explore_dashboard:
container_name: explore_dashboard
build:
context: .
dockerfile:
Dockerfile
ports:
- "8081:80"
nginx.conf:
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Now I'm able to run the app on http://127.0.0.1:8081/ running:
docker-compose up
Related
When I am trying to deploy my dockerized React application to Heroku, I just get the following error:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
I tried multiple options, but nothing worked.
Every time I get the error above or the build crashes.
Dockerfile:
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -yq curl && \
curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
EXPOSE 8080
WORKDIR /app
COPY . /app/
RUN npm install && npm run build
heroku.yml
build:
docker:
web: Dockerfile
run:
web: HOST=0.0.0.0 npm start -- --port 8080
webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
entry: path.join(__dirname, "src", "index.js"),
output: {
path:path.resolve(__dirname, "dist"),
},
module: {
rules: [
{
test: /\.(js|jsx)?$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ['#babel/preset-env', '#babel/preset-react']
}
}
},
{
test: /\.(ts|tsx)?$/,
use: 'ts-loader',
exclude: /node_modules/,
}
]
},
resolve: {
'extensions': ['.js', '.tsx', '.ts'],
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, "public", "index.html"),
}),
],
}
package.json
{
"name": "my-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --mode development",
"build": "webpack --mode=production",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"#babel/core": "^7.17.9",
"#babel/preset-env": "^7.16.11",
"#babel/preset-react": "^7.16.7",
"#tsconfig/node14": "^1.0.1",
"#types/node": "^17.0.25",
"babel-loader": "^8.2.5",
"html-webpack-plugin": "^5.5.0",
"ts-loader": "^9.2.8",
"ts-node": "^10.7.0",
"typescript": "^4.6.3",
"webpack": "^5.72.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.8.1"
},
"engines": {
"node": "14.x"
}
}
PS: Until now, I am an absolutely noob at configure node/react projects.
You can not use a specific port in heroku. Heroku automatically binds its preferred port to your web process.
Try to set the port with the environment variable $PORT. Or you can also hardcode heroku's default port. That would be the same.
HOST=0.0.0.0 npm start -- --port $PORT
//or try this
HOST=0.0.0.0 npm start -- --port 5000
//heroku's default port maybe 3000 or 5000.
//I'm not sure. Try both
I'm having an unusual problem running a basic Framework7 project with vue.
Once created a Framework7 Vue project with the command: framework7 create --ui and installed the dependencies with npm i get the following problem: Could not resolve "vue"
in all packages because the script is looking for vue inside a esm folder like: ../../../node_modules/swiper/esm/vue/swiper.js:1:79 and it's quite strange because esm folder is never existed.
The strange thing is that the same project, with the same package.json works perfectly in another pc with the same version of node (v16.14.2) and npm (8.7.0)
So the problem must be in my pc. I thought about some cache problem, but despite forcing a cache cleanup the problem remains.
For completeness I leave the json package, which is the same that framework7 create --ui command creates for a Vue project.
Has anyone ever had a similar problem or know what the cause might be?
I guess the problem could be related to npm or vite.
{
"name": "my-app",
"private": true,
"version": "1.0.0",
"description": "My App",
"repository": "",
"license": "UNLICENSED",
"scripts": {
"start": "npm run dev",
"dev": "cross-env NODE_ENV=development vite",
"build": "cross-env NODE_ENV=production vite build && npx workbox generateSW workbox-config.js",
"build-capacitor-ios": "cross-env NODE_ENV=production vite build && npx cap copy ios",
"build-capacitor-android": "cross-env NODE_ENV=production vite build && npx cap copy android",
"postinstall": "cpy --flat ./node_modules/framework7-icons/fonts/*.* ./src/fonts/ && cpy --flat ./node_modules/material-icons/iconfont/*.* ./src/fonts/"
},
"browserslist": [
"IOS >= 13",
"Safari >= 13",
"last 5 Chrome versions",
"last 5 Firefox versions",
"Samsung >= 12"
],
"dependencies": {
"#capacitor/android": "^3.4.3",
"#capacitor/app": "^1.1.1",
"#capacitor/browser": "^1.0.7",
"#capacitor/core": "^3.4.3",
"#capacitor/ios": "^3.4.3",
"#capacitor/keyboard": "^1.2.2",
"#capacitor/splash-screen": "^1.2.2",
"#capacitor/status-bar": "^1.0.8",
"dom7": "^4.0.4",
"framework7": "^7.0.1",
"framework7-icons": "^5.0.5",
"framework7-vue": "^7.0.1",
"material-icons": "^1.10.8",
"skeleton-elements": "^4.0.0",
"swiper": "^8.1.1",
"vue": "^3.2.33"
},
"devDependencies": {
"#capacitor/cli": "^3.4.3",
"#vitejs/plugin-vue": "^2.3.1",
"#vue/compiler-sfc": "^3.2.33",
"cordova-res": "^0.15.4",
"cpy-cli": "^4.1.0",
"cross-env": "^7.0.3",
"postcss-preset-env": "^7.4.3",
"vite": "^2.9.5",
"workbox-cli": "^6.5.3"
}
}
Changing in vite.config.js works for me. I have used the node_modules path for all the external bundle related errors
You can mark the path "vue" as external to exclude it from the bundle, which will remove this error.
import path from 'path';
import vue from '#vitejs/plugin-vue';
const SRC_DIR = path.resolve(__dirname, './src');
const PUBLIC_DIR = path.resolve(__dirname, './public');
const BUILD_DIR = path.resolve(__dirname, './www',);
function getPath(new_path) {
return path.resolve(__dirname, 'node_modules/' + new_path);
}
export default {
plugins: [
vue(),
],
root: SRC_DIR,
base: '',
publicDir: PUBLIC_DIR,
build: {
outDir: BUILD_DIR,
assetsInlineLimit: 0,
emptyOutDir: true,
rollupOptions: {
treeshake: false,
},
},
resolve: {
alias: {
'#': SRC_DIR,
"vue": getPath('vue/dist/vue.runtime.esm-browser.js'),
"framework7/lite-bundle": getPath('framework7/framework7-lite-bundle.esm.js'),
"framework7-vue/bundle": getPath('framework7-vue/framework7-vue-bundle.js'),
"swiper/vue": getPath('swiper/vue/swiper-vue.js'),
"skeleton-elements/vue": getPath('skeleton-elements/vue/index.js'),
},
},
server: {
host: true,
},
};
My project has recently started complaining that it can't resolve react when I run the npm run dev script, which is:
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
It seems like npm can't find the node_modules directory?
It runs fine on my windows machine, but when I upload it to the Ubuntu server I get errors.
I've tried various things, like deleting node_modules and the lock file, cleaning the npm cache, checked $NODE_PATH, reinstalled nodejs and npm to no avail.
I can't figure out if this is a path issue or I'm missing something on the server or what.
I'd appreciate any tips you have.
My package.json:
{
"private": true,
"name": "Write.nogetdigitalt.dk",
"version": "0.0.1",
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"#fortawesome/react-fontawesome": "^0.1.3",
"axios": "^0.18",
"babel-preset-react": "^6.24.1",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.5",
"moment": "^2.23.0",
"popper.js": "^1.12",
"react": "^16.5.2",
"react-datepicker": "^2.0.0",
"react-dom": "^16.5.2",
"redux": "^4.0.1",
"vue": "^2.5.7"
},
"dependencies": {
"#fortawesome/free-solid-svg-icons": "^5.5.0",
"react-icons": "^3.2.0"
}
}
webpack.mix.js
const mix = require('laravel-mix');
const webpack = require('webpack');
mix.webpackConfig({
resolve: {
extensions: ['.js', 'jsx'],
alias: {
'react': 'React'
}
},
plugins: [
new webpack.ProvidePlugin({
'React': 'react',
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default']
})
]
})
.disableNotifications()
.react('resources/js/app.js', 'public/js')
.sourceMaps()
.sass('resources/sass/app.scss', 'public/css');
Error messages:
ERROR in ./resources/js/pages/Note/Note.js
Module not found: Error: Can't resolve 'react' in '/var/www/html/write.nogetdigitalt.dk/resources/js/pages/Note'
resolve 'react' in '/var/www/html/write.nogetdigitalt.dk/resources/js/pages/Note'
Parsed request is a module
using description file: /var/www/html/write.nogetdigitalt.dk/package.json (relative path: ./resources/js/pages/Note)
aliased with mapping 'react': 'React' to 'React'
Parsed request is a module
using description file: /var/www/html/write.nogetdigitalt.dk/package.json (relative path: ./resources/js/pages/Note)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /var/www/html/write.nogetdigitalt.dk/package.json (relative path: ./resources/js/pages/Note)
resolve as module
/var/www/html/write.nogetdigitalt.dk/resources/js/pages/Note/node_modules doesn't exist or is not a directory
/var/www/html/write.nogetdigitalt.dk/resources/js/pages/node_modules doesn't exist or is not a directory
/var/www/html/write.nogetdigitalt.dk/resources/js/node_modules doesn't exist or is not a directory
/var/www/html/write.nogetdigitalt.dk/resources/node_modules doesn't exist or is not a directory
/var/www/html/node_modules doesn't exist or is not a directory
/var/www/node_modules doesn't exist or is not a directory
/var/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
You don't have installed package dependencies.
npm install
After execute that node-module directorie has created.
And launch your application.
npm run developement
For anyone else getting this kind of problems, for path definition between different OS is better to use path from NodeJS
`const path = require('path');
[...]
resolve: {
extensions: ['.js', 'jsx'],
alias: {
'react': path.resolve(__dirname, 'Path to your folder to alias')
}
}`
I have a nuxt-community/starter-template project with minimal additions. My package.json looks like this
{
// ...
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"docker-image": "nuxt build && docker build -t unijobs-www-temp .",
"start": "nuxt start",
"generate": "NODE_ENV=production nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "npm run lint"
},
"dependencies": {
"#fortawesome/fontawesome": "^1.1.8",
"#fortawesome/fontawesome-free-brands": "^5.0.13",
"#fortawesome/fontawesome-free-regular": "^5.0.13",
"#fortawesome/fontawesome-free-solid": "^5.0.13",
"#fortawesome/vue-fontawesome": "0.0.22",
"nuxt": "^1.0.0",
"nuxt-fontawesome": "^0.2.0",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.2"
},
"devDependencies": {
"babel-eslint": "^8.2.1",
"eslint": "^4.15.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-vue": "^4.0.0"
}
}
Local development looks fine, local build and start seem to work fine. However, it all goes south when I build the Docker image.
PLEASE NOTE this is not an issue with Docker, the same is true if I run equivalent steps on my own machine, in a new directory.
FROM node:stretch
ENV NODE_ENV=production
ENV HOST=0.0.0.0
EXPOSE 3000
RUN npm -g i nuxt
RUN mkdir -p /app
ADD .nuxt /app/.nuxt
ADD static /app/static
WORKDIR /app
CMD ["nuxt", "start"]
This is what I find in the logs:
2018-06-05T12:27:19.910Z nuxt:render Rendering url /
{ Error: Cannot find module 'core-js/library/fn/promise' from '/app'
at Function.module.exports [as sync] (/usr/local/lib/node_modules/nuxt/node_modules/resolve/lib/sync.js:42:15)
at r (/usr/local/lib/node_modules/nuxt/node_modules/vue-server-renderer/build.js:8332:44)
at Object.<anonymous> (server-bundle.js:1429:18)
at __webpack_require__ (server-bundle.js:27:30)
at Object.module.exports.module.exports (server-bundle.js:105:31)
at __webpack_require__ (server-bundle.js:27:30)
at Object.<anonymous> (server-bundle.js:1218:138)
at __webpack_require__ (server-bundle.js:27:30)
at server-bundle.js:92:18
at Object.<anonymous> (server-bundle.js:95:10)
at evaluateModule (/usr/local/lib/node_modules/nuxt/node_modules/vue-server-renderer/build.js:8338:21)
at /usr/local/lib/node_modules/nuxt/node_modules/vue-server-renderer/build.js:8396:18
at new Promise (<anonymous>)
at /usr/local/lib/node_modules/nuxt/node_modules/vue-server-renderer/build.js:8388:14
at Object.renderToString (/usr/local/lib/node_modules/nuxt/node_modules/vue-server-renderer/build.js:8564:9)
at Renderer.renderRoute (/usr/local/lib/node_modules/nuxt/lib/core/renderer.js:344:41)
code: 'MODULE_NOT_FOUND',
statusCode: 500,
name: 'NuxtServerError' }
However, it all goes away as soon as I plug node_modules in, next to the .nuxt and static directories. It seems some of the modules are not bundled. My nuxt.config.js file is like
module.exports = {
head: {
// Skipping noise...
},
modules: [
[ 'nuxt-fontawesome', {
component: 'fa',
imports: [
{ set: '#fortawesome/fontawesome-free-brands' },
]
}],
],
loading: { color: '#3B8070' },
build: {
extend (config, { isDev, isClient }) {
if (isDev && isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
// *** NOTE: In practice, I'm only using FA brands here, not the others ***
config.resolve.alias['#fortawesome/fontawesome-free-brands$'] = '#fortawesome/fontawesome-free-brands/shakable.es.js'
}
}
}
}
Am I doing something wrong?
I found Nuxt build will not bundle files in node_modules, so if you want to bundle all dependencies into .nuxt, you should use nuxt build --standalone.
see here: https://github.com/nuxt/nuxt.js/issues/4292
hope this will help you :)
I started following reatJS tutorial from Youtube, now I want to share my learning step by step with the LEAD developers over internet.
I have npm /node js installed on my macbook, and I after I finish work i run npm start and it gives me local host address on port 8081 , but I have apache web server running on different machine which is open to internet , so I want to deploy my reactJS app using npm / webpack to this computer running apache.
I have this package.json file setup.
{
"name": "react-basics",
"version": "1.0.0",
"description": "Some Basics ReactJS",
"main": "index.js",
"scripts": {
"start": "npm run build",
"build": "webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot",
"build:prod": "webpack -p && cp src/index.html dist/index.html"
},
"keywords": [
"reactJS"
],
"author": "Ciasto Piekarz",
"license": "MIT",
"dependencies": {
"react": "^15.5.3",
"react-dom": "^15.5.3"
},
"devDependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^6.4.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"webpack": "^2.3.3",
"webpack-dev-server": "^2.4.2"
}
}
and webpack.config.js
var webpack = require("webpack");
var path = require("path");
var DIST_DIR = path.resolve(__dirname, "dist");
var SRC_DIR = path.resolve(__dirname, "src");
var config = {
entry: SRC_DIR + "/app/index.js",
output: {
path: DIST_DIR + "/app",
filename: "bundle.js",
publicPath: "/app/"
},
module: {
loaders: [
{
test: /\.js?/,
include: SRC_DIR,
loader: "babel-loader",
query: {
presets: ["react", "es2015", "stage-2"]
}
}
]
}
};
module.exports = config;
Do I have to install npm /node.js on remote machine as well which is open to internet ? can I not just use apache web server ? if so how do I just stick to port 80 ?
I think you just need to run npm run build:prod. It will probably generate a dist folder, which should be uploaded on your server and used as your webroot folder for apache.