Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

fix(package): use exact uglify-es version (dependencies) #199

Merged
merged 1 commit into from
Dec 27, 2017
Merged

fix(package): use exact uglify-es version (dependencies) #199

merged 1 commit into from
Dec 27, 2017

Conversation

jdubois
Copy link
Contributor

@jdubois jdubois commented Dec 27, 2017

This is for fixing the uglify-es dependency, as the new 3.3.x versions breaks up all Angular builds.

See here for Angular and here for Angular CLI

@jsf-clabot
Copy link

jsf-clabot commented Dec 27, 2017

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update lock file

@michael-ciniawsky michael-ciniawsky changed the title fix uglify-es transitive dependency, as the 3.3.x release is broken fix(package): use exact uglify-es version (dependencies) Dec 27, 2017
Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this angular specific or did uglify-es >= v3.3.0 break something in general ? What is the root cause of this bug(s) ?

@michael-ciniawsky michael-ciniawsky added this to the 1.1.4 milestone Dec 27, 2017
@joshwiens
Copy link
Member

@michael-ciniawsky - Doesn't really matter. It's breaking a major integration, we will pin it in the short term & sort it out later.

I'll update the lock file

@joshwiens joshwiens merged commit 2e2ed36 into webpack-contrib:master Dec 27, 2017
@jdubois
Copy link
Contributor Author

jdubois commented Dec 27, 2017

Thanks a lot @d3viant0ne

@sokra
Copy link
Member

sokra commented Jan 3, 2018

This is not how something like that should be handled. This package just passes through uglify-es behavior. If some uglify-es version is broken for you, you can lock it's version in your application lockfile (or package.json for a library).

sokra added a commit that referenced this pull request Jan 3, 2018
@michael-ciniawsky michael-ciniawsky removed this from the 1.1.6 milestone Jan 3, 2018
@filipesilva
Copy link
Contributor

@sokra I don't think there's a way for users to lock a specific version of a subdependency, at least with NPM. There are peer dependencies, but uglify-es is not a peer dependency of uglifyjs-webpack-plugin.

For Angular CLI users what happened is that they updated their lockfile, and got uglify-es@3.3.2 in it and in npm cache. From this point on the only way they could force the lockfile to use uglify-es@3.2.2 was:

  • force a top-level uglify-es and hope hoisting works: npm i uglify-es@3.2.2 --save-exact && rm -rf package-lock.json node_modules && npm i && npm ls uglify-es (relying on hoisting is problematic since different package managers do it differently)
  • manually editing package-lock.json which requires a lot of knowledge about its inner working:
    "uglifyjs-webpack-plugin": {
      "version": "1.1.5",
      "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.1.5.tgz",
      "integrity": "sha512-YBGc9G7dv12Vjx8vUQs54DZgAXVf04LlG6dNNiEbTZjL3PbUqiY4uPB9Kv+fUJaqRskEGva/lS7sh08yJr7jnA==",
      "dev": true,
      "requires": {
        "cacache": "10.0.1",
        "find-cache-dir": "1.0.0",
        "schema-utils": "0.3.0",
        "serialize-javascript": "1.4.0",
        "source-map": "0.6.1",
        "uglify-es": "3.2.2",
        "webpack-sources": "1.1.0",
        "worker-farm": "1.5.2"
      },
      "dependencies": {
        "uglify-es": {
          "version": "3.2.2",
          "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.2.2.tgz",
          "integrity": "sha512-l+s5VLzFwGJfS+fbqaGf/Dfwo1MF13jLOF2ekL0PytzqEqQ6cVppvHf4jquqFok+35USMpKjqkYxy6pQyUcuug==",
          "dev": true,
          "requires": {
            "commander": "2.12.2",
            "source-map": "0.6.1"
          }
        }
      }
    },
// ...
    "uglify-es": {
      "version": "3.3.2",
      "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.2.tgz",
      "integrity": "sha512-g7rGvx7YiFROLXKUtFMTw+YpTVV/XXPNvDUQfzwDTcB3vINwLUr3qXnkcPCu8VCIVjxI2EqaZ+sHoAxcYE/98w==",
      "requires": {
        "commander": "2.12.2",
        "source-map": "0.6.1"
      }
    },

I don't think either option is good for users.

I wouldn't say uglifyjs-webpack-plugin just passes on uglify-es behaviour either, because from a uglifyjs-webpack-plugin user POV they have no control over uglify-es. So if there's a problem with uglify-es it is wholly reflected on the behaviour of uglifyjs-webpack-plugin while the problematic versions remain within allowed semver ranges.

The way to express that sort of relationship is peer dependencies, but I don't think that's very ergonomic. If we were to use peer dependencies for every webpack plugin then there would a lot more maintenance work involved in updating versions. Sass loader adopted that approach though (webpack-contrib/sass-loader#519).

Maybe having X-loader always have a peer dependency on X is the right way to address cases like this within NPM.

@filipesilva
Copy link
Contributor

FYI I opened a feature request in npm for a wait to set indirect dependency versions: npm/npm#19512

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

Successfully merging this pull request may close these issues.

7 participants