Question: How to deploy MERN project using webpack


How to deploy MERN project using webpack

Answers 1
Added at 2017-01-01 17:01

I use the following project which use webpack

I want to deploy it (to prod) i get error

Error: Cannot find module './dist/manifest.json' This error is coming from

But I dont see the dist folder in the project, why, and how should I build it?

I believe that the Dist folder should be created during the build time (manification etc) so how should I trigger it ?

This is the package.json

  "name": "mern-starter",
  "version": "2.0.0",
  "description": "Boilerplate project for building Isomorphic apps using React and Redux",
  "scripts": {
    "test": "cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://localhost:27017/mern-test node_modules/.bin/nyc node --harmony-proxies node_modules/.bin/ava",
    "watch:test": "npm run test -- --watch",
    "cover": "nyc npm run test",
    "check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
    "start": "cross-env BABEL_DISABLE_CACHE=1 NODE_ENV=development nodemon index.js",
    "start:prod": "cross-env NODE_ENV=production node index.js",
    "bs": "npm run clean && npm run build && npm run build:server && npm run start:prod",
    "build": "cross-env NODE_ENV=production webpack --config",
    "build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js",
    "clean": "rimraf dist",
    "slate": "rimraf node_modules && npm install",
    "lint": "eslint client server"

I think that the start:prod should trigger it in the webpack but its not happing ...any idea ?

Answers to

How to deploy MERN project using webpack

nr: #1 dodano: 2017-01-01 21:01

As per the comments and the documentation:

Building the dist folder is done either via npm run bs or npm run build && npm run build:server (which is what npm run bs executes).

Starting the production build should be done via npm run start:prod (or by copying the commands from the package.json file: cross-env NODE_ENV=production node index.js)

Source Show
◀ Wstecz