Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

webpack installed only in devDependencies but used in production #158

@scott4dev

Description

@scott4dev

Hi,

First I want to thank you very much for this awesome tutoral.
The quality of this material is great!

I've noticed that in the lesson 12-navigating the package.json file use the npm start command in this way

 "scripts": {
     "start": "if-env NODE_ENV=production && npm run start:prod || npm run start:dev",
     "start:dev": "webpack-dev-server --inline --content-base public/ --history-api-fallback",
     "start:prod": "webpack && node server.js"
},

if you run it in development mode it works like a charm but if you start from scratch and you'll do

npm install --production
NODE_ENV=production npm start

you'll get this error

> tutorial@1.0.0 start /Users/..../dev/garbage/react-router-tutorial/lessons/12-navigating
> if-env NODE_ENV=production && npm run start:prod || npm run start:dev


> tutorial@1.0.0 start:prod /Users/..../dev/garbage/react-router-tutorial/lessons/12-navigating
> webpack && node server.js

sh: webpack: command not found

as you can see from the copied package.json here below webpack is installed only in development mode

{
  "name": "tutorial",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "if-env NODE_ENV=production && npm run start:prod || npm run start:dev",
    "start:dev": "webpack-dev-server --inline --content-base public/ --history-api-fallback",
    "start:prod": "webpack && node server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "compression": "^1.6.1",
    "if-env": "^1.0.0",
    "react": "^0.14.7",
    "react-dom": "^0.14.7",
    "react-router": "^2.0.0"
  },
  "devDependencies": {
    "babel-core": "^6.5.1",
    "babel-loader": "^6.2.2",
    "babel-preset-es2015": "^6.5.0",
    "babel-preset-react": "^6.5.0",
    "http-server": "^0.8.5",
    "webpack": "^1.12.13",
    "webpack-dev-server": "^1.14.1"
  }
}

I've discovered this issue publishing an app based on the package.json to heroku.
Maybe a solution like this can help you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions