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

uglify-js is unconditionally imported, but only listed as optional dependency #1391

Closed
Turbo87 opened this issue Oct 11, 2017 · 9 comments · Fixed by #1394
Closed

uglify-js is unconditionally imported, but only listed as optional dependency #1391

Turbo87 opened this issue Oct 11, 2017 · 9 comments · Fixed by #1394

Comments

@Turbo87
Copy link
Contributor

Turbo87 commented Oct 11, 2017

This is causing ember-cli/ember-cli#7371, where people are using npm to install handlebars as a transitive dependency but apparently npm is not installing the optional uglify-js dependency (anymore?) which makes the import fail.

@kellyselden
Copy link

This would need to be a 4.x fix right?

@Turbo87
Copy link
Contributor Author

Turbo87 commented Oct 11, 2017

either that or we update the dependency in https://github.com/ember-cli/broccoli-middleware/blob/master/package.json#L22. not sure if that's possible though 🤔

@nknapp
Copy link
Collaborator

nknapp commented Oct 12, 2017

I can do the release if anyone creates a PR. And yes, it should be a PR for the 4.x branch. I'll merge into master afterwards.

What about 3.x?

nknapp added a commit that referenced this issue Oct 13, 2017
closes #1391

uglify-js is an optional dependency and should be treated as such.
This commit gracefully handle MODULE_NOT_FOUND errors while loading
uglify.
nknapp added a commit that referenced this issue Oct 13, 2017
closes #1391

uglify-js is an optional dependency and should be treated as such.
This commit gracefully handles MODULE_NOT_FOUND errors while loading
uglify.
nknapp added a commit that referenced this issue Oct 13, 2017
closes #1391

uglify-js is an optional dependency and should be treated as such.
This commit gracefully handles MODULE_NOT_FOUND errors while loading
uglify.
nknapp added a commit that referenced this issue Oct 13, 2017
closes #1391

uglify-js is an optional dependency and should be treated as such.
This commit gracefully handles MODULE_NOT_FOUND errors while loading
uglify.
nknapp added a commit that referenced this issue Oct 13, 2017
closes #1391

uglify-js is an optional dependency and should be treated as such.
This commit gracefully handles MODULE_NOT_FOUND errors while loading
uglify.
nknapp added a commit that referenced this issue Oct 17, 2017
closes #1391

uglify-js is an optional dependency and should be treated as such.
This commit gracefully handles MODULE_NOT_FOUND errors while loading
uglify.

- Check for existing uglify-js (and load uglify-js) only if minification
  was activated
- Use "require.resolve" to check if uglify exists. Otherwise, a missing
  dependency of uglify-js would cause the same behavior as missing
  uglify-js. (Only a warning, no error)
- The code to load and run uglify is put into a single for readability
  purposes
- Tests use a mockup Module._resolveFilename to simulate the missing module.
  This function is used by both "require" and "require.resolve", so both
  are mocked equally.
nknapp added a commit that referenced this issue Oct 17, 2017
closes #1391

uglify-js is an optional dependency and should be treated as such.
This commit gracefully handles MODULE_NOT_FOUND errors while loading
uglify.

- Check for existing uglify-js (and load uglify-js) only if minification
  was activated
- Use "require.resolve" to check if uglify exists. Otherwise, a missing
  dependency of uglify-js would cause the same behavior as missing
  uglify-js. (Only a warning, no error)
- The code to load and run uglify is put into a single for readability
  purposes
- Tests use a mockup Module._resolveFilename to simulate the missing module.
  This function is used by both "require" and "require.resolve", so both
  are mocked equally.
nknapp added a commit that referenced this issue Oct 17, 2017
closes #1391

uglify-js is an optional dependency and should be treated as such.
This commit gracefully handles MODULE_NOT_FOUND errors while loading
uglify.

- Check for existing uglify-js (and load uglify-js) only if minification
  was activated
- Use "require.resolve" to check if uglify exists. Otherwise, a missing
  dependency of uglify-js would cause the same behavior as missing
  uglify-js. (Only a warning, no error)
- The code to load and run uglify is put into a single for readability
  purposes
- Tests use a mockup Module._resolveFilename to simulate the missing module.
  This function is used by both "require" and "require.resolve", so both
  are mocked equally.

(cherry picked from commit d5caa56)
@nknapp
Copy link
Collaborator

nknapp commented Oct 17, 2017

Released in 4.0.11

@Turbo87
Copy link
Contributor Author

Turbo87 commented Oct 17, 2017

awesome, thanks :)

@Turbo87
Copy link
Contributor Author

Turbo87 commented Oct 17, 2017

What about 3.x?

I think our issue was only with 4.x. Since 5.x seems to be the current release I think we're probably fine without another 3.x release.

@nknapp
Copy link
Collaborator

nknapp commented Oct 17, 2017

The current release is 4.x. There has not been any 5.x release yet
If nobody needs a new 3.x release, I'll save my time for other stuff.

@Turbo87
Copy link
Contributor Author

Turbo87 commented Oct 17, 2017

🤔

thought I had seen 5.x somewhere... nevermind, sorry about the noise :D

@nknapp
Copy link
Collaborator

nknapp commented Oct 18, 2017

I bumped the master branch to 5.0-alpha. But there is no release at the moment and I'm only doing bugfixes

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

Successfully merging a pull request may close this issue.

3 participants