Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevDependencies vs Dependencies #160

Closed
artemgurzhii opened this issue Mar 5, 2017 · 4 comments
Closed

DevDependencies vs Dependencies #160

artemgurzhii opened this issue Mar 5, 2017 · 4 comments

Comments

@artemgurzhii
Copy link

Current behaviour

"dependencies": {
    "babel-core": "^6.23.1",
    "babel-preset-env": "^1.2.0",
    "coffee-loader": "^0.7.3",
    "coffee-script": "^1.12.4",
    "compression-webpack-plugin": "^0.3.2",
    "glob": "^7.1.1",
    "path-complete-extname": "^0.1.0",
    "rails-erb-loader": "^3.2.0",
    "webpack": "^2.2.1",
    "webpack-merge": "^3.0.0"
  }

expected

"devDependencies": {
    "babel-core": "^6.23.1",
    "babel-preset-env": "^1.2.0",
    "coffee-loader": "^0.7.3",
    "coffee-script": "^1.12.4",
    "compression-webpack-plugin": "^0.3.2",
    "glob": "^7.1.1",
    "path-complete-extname": "^0.1.0",
    "rails-erb-loader": "^3.2.0",
    "webpack": "^2.2.1",
    "webpack-merge": "^3.0.0"
  }

Installed via yarn packages should be added to the devDependencies as they used only in development.

@gauravtiwari
Copy link
Member

gauravtiwari commented Mar 6, 2017

Hey @artemgurzhii, please checkout this issue - #117, it's discussed here. Feel free to close this issue, if that answers your question :)

@artemgurzhii
Copy link
Author

artemgurzhii commented Mar 6, 2017

Will something like this solve problem?

if ENV['NODE_ENV'] == 'production'
  run './bin/yarn add webpack webpack-merge path-complete-extname babel-loader babel-core babel-preset-env coffee-loader coffee-script compression-webpack-plugin rails-erb-loader glob'
  run './bin/yarn add --dev webpack-dev-server'
else
  run './bin/yarn add --dev webpack webpack-merge path-complete-extname babel-loader babel-core babel-preset-env coffee-loader coffee-script compression-webpack-plugin rails-erb-loader glob webpack-dev-server'

@gauravtiwari
Copy link
Member

@artemgurzhii This installer is run only once, when you add webpacker using webpacker:install. Obviously, you can do that, but it's not something that will work,

  1. You will have to install webpacker in production in all your deploys, manually (for container-based)
  2. Your package.json will go out-of-sync, say if you are using Git. You commit something and then production installs something differently, resulting in conflicts.
  3. Number#2 will then introduce version differences because you got two package.json, technically

btw, what are your concerns on this? If you look at the webpack config files, you will see the dependencies that are being installed as primary are used in same way in both the environments so, that means they are dependencies of the app as whole - whether it's a build tool or plugins used by build tool.

@artemgurzhii
Copy link
Author

@gauravtiwari Haven't thought about that, thanks for explaining)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants