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

fix: use NODE_OPTIONS instead of calling node directly for debugging #350

Merged
merged 3 commits into from
Aug 29, 2023
Merged

fix: use NODE_OPTIONS instead of calling node directly for debugging #350

merged 3 commits into from
Aug 29, 2023

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Aug 18, 2023

Summary

Currently debugging options for node are handled by switching to calling node which is fine except requires the absolute path to the javascript file to execute to be passed which isn't what happens if node_modules_bin_exist? is false because that falls back to just yarn webpack and yarn webpack serve:

cmd = if node_modules_bin_exist?
  ["#{@node_modules_bin_path}/webpack", "serve"]
else
  ["yarn", "webpack", "serve"]
end

This switches to providing those options using the NODE_OPTIONS env variable instead, which should ensure the options are always enabled regardless of how the desired commands are invoked.

This change also makes #349 / #195 a little easier.

Pull Request checklist

  • Add/update test to cover these changes
  • Update documentation
  • Update CHANGELOG file

Other Information

I have tested this locally using NODE_OPTIONS="--unhandled-rejections=warn" and having a Promise.reject() in the webpack config - I've not added any test cases since none exist already for this section, and it's a bit tricky to automate for the test suite.

Copy link
Member

@justin808 justin808 left a comment

Choose a reason for hiding this comment

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

Please change and I'll merge.

lib/shakapacker/dev_server_runner.rb Outdated Show resolved Hide resolved
lib/shakapacker/webpack_runner.rb Outdated Show resolved Hide resolved
@G-Rath G-Rath requested a review from justin808 August 29, 2023 04:01
@justin808 justin808 merged commit 8617937 into shakacode:master Aug 29, 2023
@G-Rath G-Rath deleted the use-node-options branch August 29, 2023 20:16
@G-Rath G-Rath mentioned this pull request Aug 29, 2023
3 tasks
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 this pull request may close these issues.

2 participants